Hide last authors
dvd48 3.1 1 (% style="text-align:center" %)
2 [[image:t-rex.gif||class="img-rounded"]]
3
4 (% class="box infomessage" %)
5 (((
dvd48 11.1 6 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.
dvd48 3.1 7 )))
admin 1.1 8
dvd48 3.1 9 (% class="box" %)
10 (((
admin 1.1 11 == What bricks do you need? ==
12
13 Create a new program and add the following object:
14
dvd48 3.1 15 (% style="text-align:center" %)
dvd48 10.1 16 [[image:object.png]]
dvd48 3.1 17 )))
admin 1.1 18
dvd48 3.1 19 (% class="row" %)
20 (((
21 (% class="col-xs-12 col-sm-6" %)
22 (((
23 (% class="box" %)
24 (((
25 = Now add these scripts to the dot object: =
26
27 **~1. Step**
28
admin 1.1 29 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.
30
dvd48 3.1 31 (% style="text-align:center" %)
dvd48 10.1 32 [[image:1.png]]
dvd48 3.1 33 )))
34 )))
admin 1.1 35
dvd48 3.1 36 (% class="col-xs-12 col-sm-6" %)
37 (((
38 (% class="box" %)
39 (((
40 **2. Step**
41
42 Now add the** pen down-brick**. From now on the **dot **object is drawing a line.
43
44 (% style="text-align:center" %)
dvd48 10.1 45 [[image:2.png]]
dvd48 3.1 46 )))
47 )))
48 )))
49
50 (% class="row" %)
51 (((
52 (% class="col-xs-12 col-sm-6" %)
53 (((
54 (% class="box" %)
55 (((
56 **3. Step**
57
admin 1.1 58 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.
59
dvd48 3.1 60 (% style="text-align:center" %)
dvd48 10.1 61 [[image:3.png]]
dvd48 3.1 62 )))
63 )))
64
65 (% class="col-xs-12 col-sm-6" %)
66 (((
67 (% class="box" %)
68 (((
69 **4. Step**
70
admin 1.1 71 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.
72
dvd48 9.1 73 (% style="text-align:center" %)
dvd48 10.1 74 [[image:4.png]]
dvd48 3.1 75 )))
76 )))
77 )))
admin 1.1 78
dvd48 3.1 79 (% class="box" %)
80 (((
dvd48 10.1 81 == Remix Inspirations ==
admin 1.1 82
83 [[Change how the t-rex detector looks like>>https://share.catrob.at/pocketcode/program/31926]]
84
85 [[Add functionality to the t-rex detector >>https://share.catrob.at/pocketcode/program/32735]]
dvd48 3.1 86 )))
dvd48 12.1 87
88 (% class="box infomessage" %)
89 (((
90 [[Download the program>>https://share.catrob.at/pocketcode/program/31927]]
91 )))