Connect. The round patch under the 3D robot is the floor colour it sees.
Drive onto coloured paper. The patch changes colour.
Drive slowly across black tape. The three rings at the nose go dark.
Pick the robot up. The 3D robot rises.
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.
Line sensors: three lights shining down. Pale floor reflects (low number), black tape soaks it up (high number).
Colour sensor:red, green, blue = alvik.get_color(), each 0 to 1. The page paints the patch with them.
Picked up: the downward distance reads about 7 cm on a desk. If it grows, the robot was lifted.
Tipped: a motion chip gives roll and pitch. The page ignores leans under 8 degrees, and bumps that last only a moment, so it doesn't wobble on a bumpy floor.
New sensor, new packet letter: old pages skip letters they don't know, so nothing breaks.
๐งช Try this
Colour hunt. What colour does it think the carpet is? A wooden table?
Table edge. Hold the robot with its nose over the edge (don't drive!). What do the rings show?
Lift or cliff? When else would the downward distance grow?
โ๏ธ 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.