Program CyberPi with mBlock 5

This page describes how to Program CyberPi with mBlock 5.
  1. Download and install the required software
  2. Connect CyberPi to mBlock 5
  3. Start to write the program
  4. Upload the program to CyberPi
  5. Execute the program

1. Download and install the required software

2. Connect CyberPi to mBlock 5

Before programming CyberPi, you need to connect it to mBlock 5.
Refer to the following instructions according to your mBlock 5 version:
  • Connect CyberPi to the mBlock 5 PC client
  • Connect CyberPi to mBlock 5 on the web

Connect CyberPi to the mBlock 5 PC client

(1) Use a Micro USB cable (Type-C) to connect CyberPi to your PC, and power on CyberPi.

1280X1280_-_2023-03-14T105226.434.PNG

(2) Double-click the mBlock 5 icon on your PC to open it.

1280X1280_-_2023-03-14T105303.350.PNG

(3) On the Devices tab, click + add, select CyberPi, and click OK.

1280X1280_-_2023-03-14T105336.297.PNG

(4) Click Connect to connect CyberPi to mBlock 5.

A message is displayed after CyberPi is connected, indicating that the connection is successful.

1aabb1e6-a375-4073-af54-f2313fa421d5.png

Connect CyberPi to mBlock 5 on the web

(1) Use a Micro USB cable (Type-C) to connect CyberPi to your PC, and power on CyberPi.

ea31efbd-f1f6-447e-9543-0ad7e9372adc.png

(2) Double-click the mLink 2 icon on your PC to open it.

bd1845ac-ee2d-4ac8-af1d-311e319f3fb6.png

(3) Click Create now in the mBlock block-based editor area to open mBlock 5 on the web.

ad4a9eec-aaf8-4961-8d51-a8e57349e071.png

(4) Click the Devices tab, click + add, select CyberPi, and click OK.

bd0d8403-b87b-4477-914d-50b31cb869a2.png

(5) Click Connect to connect CyberPi to mBlock 5.

015f9d5a-3a03-4b21-b4a7-98443ad7a50e.png

A message is displayed after CyberPi is connected, indicating that the connection is successful.

0062422d-620c-408d-ae2d-2808383fd824.png

 

3. Set the programming mode

mBlock 5 provides two programming modes, namely Live and Upload. You can click to switch the mode.
Live: In this mode, you can view the program execution effect in real-time, which facilitates the debugging of the program. In this mode, you must keep CyberPi connected to mBlock 5. If they are disconnected, the program cannot be executed.
Upload: In this mode, you need to upload the compiled program to CyberPi. After being successfully uploaded, the program can still run properly on CyberPi when it is disconnected from mBlock 5.
Now you can start to program CyberPi!

(1) Drag the blocks required to the scripts area.

a. First, define the event for triggering the play LED animation program. For example, trigger the program by pressing button B.
Tap the Events category, drag the block when button () pressed to the scripts area, and tap the drop-down list box to select button B.

284c8bcb-2054-4ff6-a320-1fb8d4fc28cb.png

b. Define the effect of playing the LED animation. For example, to play a rainbow animation.
Tap on the LED category and drag the block play LED animation()until done to the script area. Tap on the drop-down box and select rainbow.

61b2b117-62cf-4140-8c52-0a4b19653bae.png

4. Upload the program to CyberPi

ead72a07-dd1e-4d0e-a677-eaac85a8c072.png

587495bb-ee5c-47dd-b274-8df718b0d755.png

a3ac0bfd-ce72-4fcf-95e3-841cc385c1c7.png

Note: The program you upload will replace the last program you executed on CyberPi.Tap the Upload icon, and wait till the uploading is complete.

5. Execute the program

Press button B on CyberPi.

0be14a04-7b0c-4119-8e5a-3d6fa87220e0.png

Tips:
  • You can change the animation effects on the blocks or add more conditions to compile your own LED animation program.
Was this article helpful?
0 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.