Last modified by dvd48 on 2020/06/14 20:25


Use the phone sensors to create a t-rex detector. Now you know if a dino or a person is creeping up. Follow these steps to create a first version. Remix it afterwards and create something personal.

What bricks do you need?

Create a new program and add the following object:


Now add these scripts to the dot object:

1. Step

The dot which visualizes the vibration should start at the upper edge of your phone. Set the y-value to the maximum of your phone’s screen. In this example it is 960. Also set the size of the dot to a size you like.


2. Step

Now add the pen down-brick. From now on the dot object is drawing a line.


3. Step

The dot is ready to move over the whole stage. To do this reduce the y-value by minus 1 for the whole screen height. The screen height can be easily computed by multiplying the maximum y-value with two.


4. Step

You have to set the x-value of the dot according to the vibration. For this you can use a combination of the accelerations of the phone. Just add the accelerations of the x, y, and z direction and multiply the sum with the factor 100. You find the “acceleration_x”, “acceleration_y” and “acceleration_z” sensor value under the category device in the formula editor. Change the factor if you want the detector to react more or less sensitive.