October 6th, 2016
This is a walkthrough/how-to for Activity 1.2.3 Creating Mobile Apps.
This requires you to have done the steps shown here first:
Go to “Blocks” on the top right corner.
Now go back to “designer” and under “layout”, drag an accelerometer to the screen. It will appear under “nonvisible components”.
Back in “Blocks”, click on “AccelerometerSensor1” and drag a “when AccelerometerSensor1 AccelerationChanged” block onto your viewer.
Next, drag three “set ” blocks from the “Variables” menu.
Drag them onto the “AccelerationChanged” block.
Change the option to red, green, and blue respectively. Next, click on the accelerometer and drag an “AccelerometerSensor1.XAccel” next to red, and duplicate it 3 times. Change the XAccel to Yaccel for green, and ZAccel for blue.
Next, drag a “Floor” block from the “Math” section next to the “Set” blocks.
After, add an additional block, also from the math section.
Add a number block from the math section, and enter the number “10”. this is because -10 is the lowest number you will get, but you can’t have a negative color.
Add a multiplication block from the math section, and drag it to the sensor block.
Have it multiply the accelerometer value by 25 using the multiply block and a number block. This is so that the max value we will receive is 250(10*25).
Finally, drag the sliders below the canvas since we no longer need them.
You should be done.
Comments Are Not Yet Implemented.