Program a Device on mBlock 5

On mBlock 5, you can program Makeblock hardware devices, micro:bit, and Arduino devices as well as sprites.

This page describes how to program CyberPi with mBlock 5 on your computer.

Connect CyberPi to mBlock 5

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


2. Open mBlock 5, click + add, and choose CyberPi in Device Library that appears.

Note: If you use mBlock 5 on the web, download and install mLink2 first.


Tips: If you use another hardware device, choose a device extension accordingly.

3. Click Connect.


A message is displayed after CyberPi is connected to mBlock 5.


You can start coding now!


Program CyberPi

You can wirte your programs to control CyberPi.

On this page, let's wirte a program to make the LEDs on CyberPi work in marquee mode.

1. Set the coding mode to Live.

mBlock 5 provides two coding modes, namely Live and Upload.

You can click to switch between the modes.


Live: In this mode, you can view what happens in real time when you execute a program, which allows you to debug your program. In this mode, you must keep CyberPi connected to mBlock 5. If they are disconnected, programs can't be executed.

Upload: In this mode, you need to upload your code to CyberPi. After being successfully uploaded, the program can run properly on CyberPi no matter it is connected to or disconnected from mBlock 5.

2. Set the initial color(s) of the LEDs.


Set the initial colors to red, orange, yellow, green, and cyan.

3. Set a condition for rolling the colors.


Each time you press button A on CyberPi, the colors roll from left to right by one position.

4. Add an event that triggers the program.


The program is to be executed when you press the space key.


The Marquee program is complete.

Press the space key, and then keep pressing button A to see what happens.


More examples

Programming mBot Neo with the Mobile mBlock 5 App

Was this article helpful?
4 out of 7 found this helpful



Please sign in to leave a comment.