Robot mBot2: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 7: | Line 7: | ||
start it: sudo mblock-mlink start | start it: sudo mblock-mlink start | ||
=== Connection via Wifi === | |||
* Before doing this step, you have to do the following step "Setup editor & Device" | |||
* After that, in the editor, switch to "Upload" mode instead of "Live" in the left panel. Switch the editor to "Python" execute this script.<syntaxhighlight lang="python"> | |||
import cyberpi as cpi | |||
import time | |||
cpi.console.clear() | |||
try: | |||
# Line 8 is here: | |||
cpi.network.config_sta("SSID_NAME", "PASSWORD") | |||
cpi.console.println("Connecting...") | |||
except Exception as e: | |||
cpi.console.println("Error details:") | |||
cpi.console.println(str(e)) | |||
while not cpi.network.is_connect(): | |||
time.sleep(0.1) | |||
cpi.console.println("Success!") | |||
</syntaxhighlight> | |||
== Setup editor & Device == | == Setup editor & Device == | ||
| Line 13: | Line 35: | ||
https://ide.mblock.cc/ | https://ide.mblock.cc/ | ||
* Connect the mbot2 via usb | |||
* Add a new device "mBot2" using the button the left side | * Add a new device "mBot2" using the button the left side | ||
* Click on Switch to mLink (in the image it shows "direct connection") | * Click on Switch to mLink (in the image it shows "direct connection") | ||
| Line 18: | Line 41: | ||
[[File:Mbot2.png|none|thumb]] | [[File:Mbot2.png|none|thumb]] | ||
=== Update Firmware === | |||
Having selected mbot2, click on settings and Firmware Update to make sure you have the latest version | |||
== Basic example == | == Basic example == | ||
Latest revision as of 12:44, 18 March 2026
Installation
mLink Controller
Ubuntu
Driver: https://dl.makeblock.com/mblock5/linux/mLink-1.2.0-amd64.deb
start it: sudo mblock-mlink start
Connection via Wifi
- Before doing this step, you have to do the following step "Setup editor & Device"
- After that, in the editor, switch to "Upload" mode instead of "Live" in the left panel. Switch the editor to "Python" execute this script.
import cyberpi as cpi import time cpi.console.clear() try: # Line 8 is here: cpi.network.config_sta("SSID_NAME", "PASSWORD") cpi.console.println("Connecting...") except Exception as e: cpi.console.println("Error details:") cpi.console.println(str(e)) while not cpi.network.is_connect(): time.sleep(0.1) cpi.console.println("Success!")
Setup editor & Device
Online IDE
- Connect the mbot2 via usb
- Add a new device "mBot2" using the button the left side
- Click on Switch to mLink (in the image it shows "direct connection")
- Click Connect

Update Firmware
Having selected mbot2, click on settings and Firmware Update to make sure you have the latest version
Basic example
On the side panel, you can select the different events and actions we want to make. In this example, we use:
- Event: when jostick is pulled up
- Display: clear screen
- Display: print message
- LED: play animation
- Audio: play hi
- mBot2 Chassis: move forward 1 cm
