Robot mBot2

From A Technological Wiki
Jump to navigation Jump to search

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

https://ide.mblock.cc/

  • 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