download.makeblock.comdownload.makeblock.com/Airblock Coding Examples with... · Web viewThe master...

11
Airblock Coding Examples with Makeblock APP I. Palette: To adjust the LED light of master controller module precisely, and to bring different dazzling gleam. Operational Panel: Function 1. After using Makeblock app to connect with master controller module, please slide the three sliders on the right side separately. The RGB LED lights will show the color by adjusting the value of color red, green and blue in RGB light to have the blending color. 2. When click the carousel lantern button on the left side or turn on the auto switch, No.1, No.2 and No.3 LED will flash in counterclockwise direction successively based on the current blending color from the RGB LED light of the master controller module. 3. When clicking the “Flash” button on the left side or turn on the auto switch, the 3 RGB LED lights are flashing according to the current blending color. 4. Click the “Light-off” button on the left side, and the LED lights of the master controller module will goes off. Significance 1. To learn the theory of blending color in RGB. 2. To learn Blockly commands, such as variable and circulation.

Transcript of download.makeblock.comdownload.makeblock.com/Airblock Coding Examples with... · Web viewThe master...

Airblock Coding Examples with Makeblock APP

1. Palette: To adjust the LED light of master controller module precisely, and to bring different dazzling gleam.

Operational Panel:

Function

1. After using Makeblock app to connect with master controller module, please slide the three sliders on the right side separately. The RGB LED lights will show the color by adjusting the value of color red, green and blue in RGB light to have the blending color.

1. When click the carousel lantern button on the left side or turn on the auto switch, No.1, No.2 and No.3 LED will flash in counterclockwise direction successively based on the current blending color from the RGB LED light of the master controller module.

3. When clicking the “Flash” button on the left side or turn on the auto switch, the 3 RGB LED lights are flashing according to the current blending color.

4. Click the “Light-off” button on the left side, and the LED lights of the master controller module will goes off.

Significance

1. To learn the theory of blending color in RGB.

1. To learn Blockly commands, such as variable and circulation.

1. To guide customers to design more light interactive cases by modifying source code.

Please refer to the source code below:

Sliders: The three sliders are using the same code. When you slide those three sliders respectively, you will receive the data from 0 to 254, and the data is corresponding to the RGB value. Meanwhile, the value is sent to the master controller module, and the RGB lights will flash in corresponding color.

Numberic Display: The three numberic display commands show the value of sliding blocks respectively.

Carousel Lantern: turn No.1 lights on, then off, No.2 Lights on, then off, No.3 lights on, then off, and repeat this cycle. (The color of the light is subject to the slider adjustment)

Flash: To design the flashing effect by setting all the lights on, then off successively, and repeating this cycle. (The color of the light is subject to the slider adjustment)

Turn off light: Set the value of the light as 0, then all the lights turn off.

1. Auto Table Lamp: change the color of the RGB light based on placing master controller module in different angle.

Control Panel

Function

1. When the app connects with master controller module, click the power switch, and then the program is executed.

1. When you put the master controller module facing up on the table, the lights turn off.

1. When you put the master controller module stands on the table, the lights go on. If you spin the master controller module, the port 1-6 will light up in different colors while facing up.

1. You could adjust the lighting intensity by sliding the corresponding blocks.

1. The three numberic displays show the current values of the gyroscope’s X,Y,Z.

Current problem: Blockly executes program too slow, so the color changes of lights are also slow.

Significance

1. To experience the feature and the usage of the gyro.

2. To learn Blockly commands, such as how to judge, RGB blending color, and loop.

3. To guide customers to design more interesting interaction games.

Please refer to the source code below:

Main program (Master controller module):

According to the values of gyro X and the Z-axis, you could determine the angle of the master controller module.

When the program detects the master controller module facing up, all the lights turn off.

When the program detects that the master controller module is not facing up, it could determine which side is facing up, and show the corresponding color.

Numberic Displays

To display the real-time digitals from X, Y, and Z axis of the master controller module.

Sliders:

The main program doesn't have the code, but you could get the values of RGB by using sliders’current numbers multiply 2.55.

1. Colorful Gyro

Function:

Please assemble six power modules in clockwise direction or counterclockwise perpendicularlly. When you click the power button, Airblock will spin in a high speed while showing lights in different colors.

Program

When you click the button, all motors are rotating at the highest speed of 2000, and design the LED flashing in different colors.

1. Lucky Star

(It is for practice, so we don’t provide coding for this sample.)

Function

Put the master controller module on the table horizontally, and operate the program, RGB lights in green.

Placing the master controller module facing up, RGB lights will flash in color white or purple randomly.

If the color in purple, the lights flash after 2 seconds, which indicates victory.

If the color in white, the lights turn off after 2 seconds, which indicates failure.

When you put the master controller module on the table again, the RGB lights will back in green. The master controller module is waiting for to be stood up again, and it will show color white or purple randomly.

Significance:

To learn commands, including but not limited to, random numbers, judgments, loops, RGB blending, and gyro values.