Skip to content

Demo (EN)

Thomas Euler edited this page Apr 9, 2022 · 4 revisions

One simple demo program each for MMBasic and MicroPython can be found in Code. The basic functionality of the two programs is very similar, but there are minor differences. There are detailed explanations of the structure of the MMBasic program here.

How to prepare the Pico, update the respective firmware if necessary and get the code onto the Pico is explained on separate pages for MMBasic and MicroPython respectively.

Basic functionality

After starting the program, the robot waits for the 'A' key to be pressed. If the robot is active, the program is terminated by pressing the X key. When the robot is active, it will start running; the RGB LED on the display breakout will pulsate. As described in Distance Sensors, the robot will only run forward if no object is detected by the sensors and no table edge is detected. Depending on the obstacle, the robot stops and turns away from the obstacle or, if necessary, goes back a few steps first.

The display shows various values, including the battery level, what "type" of obstacle was detected, and the readings from the sensors. This display currently differs between the MicroPython and the MMBasic version.

Calibration of the leg position

A short MicroPython script helps to calibrate the leg and servo positions. One loads it into the editor of choice and executes it in the REPL directly on the microcontroller. It queries all servos and their extreme positions one after the other; one can then confirm the current position in each case (y) or correct it by entering a positive or negative amount in microseconds.

At the beginning of the script it expects the following information:

SRV_ID = bytearray([0,1,2])
SRV_PIN = bytearray([board.D21, board.D10, board.D2])
SRV_RANGE_US = [(1110, 1810), (1100, 1800), (1291, 1565)]
SRV_RANGE_DEG = [(-40, 40), (-40, 40), (-20, 20)]

When the script has run, it prints the lines SRV_RANGE_US and SRV_RANGE_DEG to the history, which can be used to replace the corresponding lines in rbl2_config.py.

Continue to Extensions & Modifications

Home

  1. Werkzeuge und Material (DE | EN)
  2. Aufbau
    2.1 Mechanik (DE | EN)
    2.2 Aufbau und Hinweise (DE | EN)
    2.3 Elektronik und Platine (DE | EN)
  3. Sensoren (DE | EN)
  4. Demo (DE | EN)
  5. Erweiterungen & Modifikationen
    5.1 Alternatives Display (DE | EN)
    5.2 CO2-Wächter (DE | EN)
  6. Galerie (DE | EN)
  7. Software - MMBasic
    7.1 MMBasic zum Laufen bringen (DE | EN)
    7.2 Kommentare zum Programm (DE | EN)
    7.3 Robotling API (DE | EN)
    7.4 Building PicoMite MMBasic (DE | EN)
  8. Software - MicroPython
    8.1 Running MicroPython (DE | EN)
    8.2 Building MicroPython (DE | EN)
Clone this wiki locally