Before you start, make sure that you've got:
1. Download and install the mBlock app
Scan the QR code below with your smart device.
Alternatively, you can search for mBlock in an app store.
2. Connect CyberPi to the mBlock app
(1) Enable Bluetooth on your smart device.
(2) Power on CyberPi.
(3) Tap to open the mBlock app.
(4) Tap Coding, and tap + on the page that appears.
(5) In the Sprite Library, choose Devices > CyberPi and tap √.
(6) Tap the CyberPi setting icon and then tap Connect on the Device setting page that appears.
(7) Place your smart device close to CyberPi.
mBlock automatically searches for and connects to CyberPi.
After the connection is complete, a voice message is played, indicating that the connection is successful.
3. Write a program
(1) Tap Back to coding.
(2) Set the programming mode to Upload.
Live: In this mode, you can view the program running effect in real time, which facilitates the debugging of the program. In this mode, you must keep CyberPi connected to mBlock. If they are disconnected, the program can't be run.
Upload: In this mode, you need to upload the compiled program to CyberPi. After being successfully uploaded, the program can still run normally on CyberPi when it is disconnected from mBlock.
(3) Drag blocks to the scripts area.
a. Define the time for triggering the program of playing an LED animation by selecting an appropriate block from the Events category. For example, if you want to trigger the program by pressing button B, you can select the block when button () pressed.
Tap Events, drag the block when button () pressed to the scripts area, and tap the drop-down list box to select B.
b. Define the effect of the LED animation to be played. For example, play a rainbow animation.
Tap LED and drag the block play LED animation () until done to the scripts area. Tap the drop-down list box and select rainbow.
4. Upload the program to CyberPi
Note: The program you upload will replace the last program you ran on CyberPi. Tap the upload icon, wait until the upload is complete, and tap OK.
5. Run the program
Press button B on CyberPi.
Tip: You can use the blocks on the mBlock app to change the LED animation effect or add more conditions to compile your own LED animation program.