๐Ÿ“š Alvik lessons

Lesson 7 of 9 ยท about 20 minutes

๐ŸŒˆ Underneath

The sensors that look down and feel the robot tip. The 3D robot shows the floor's colour, black lines, and being picked up.

๐Ÿงฐ You need

๐Ÿค– Open the remote ๐ŸŽฎ Pretend robot

โ–ถ๏ธ Do it

  1. Connect. The round patch under the 3D robot is the floor colour it sees.
  2. Drive onto coloured paper. The patch changes colour.
  3. Drive slowly across black tape. The three rings at the nose go dark.
  4. Pick the robot up. The 3D robot rises.
  5. Tip it each way. The 3D robot leans too.

Pretend robot: drive over the tape and mats; tap ๐Ÿซณ to pick it up.

๐Ÿ” How it works

A third packet, U for under, carries these readings.

New sensor, new packet letter: old pages skip letters they don't know, so nothing breaks.

๐Ÿงช Try this

โœ๏ธ Peek with code

Run this in Arduino Lab for MicroPython and slide paper under the robot:

from arduino_alvik import ArduinoAlvik
from time import sleep_ms

alvik = ArduinoAlvik()
alvik.begin()

while True:
    print("lines", alvik.get_line_sensors(),
          "colour", alvik.get_color(),
          "floor", alvik.get_distance_bottom())
    sleep_ms(300)

The thresholds in sensing.js are partly guesses: tune them with what your robot prints.