Lesson 1 of 9 ยท about 15 minutes
Put this project's code on your Alvik from the browser, then meet the colour menu.
This replaces the robot's menu program. Its three built-in programs stay. To go back, copy
examples/demo onto the robot.
โฌ โฌ change colour, โ runs it, โ goes back.
| Lights | Program | What it does |
|---|---|---|
| ๐ด red | Touch-move | Tap arrows to line up moves, โ to run them. |
| ๐ต blue | Line follower | Follows a black line. The menu starts here. |
| ๐ข green | Hand follower | Keeps about 10 cm from your hand. |
| ๐ฃ purple | Remote | Drive it from a phone (lesson 2). |
| โช white, ๐ก yellowโฆ | Your extras | One colour each. |
Programs come in pages of six. On page 2 the light blinks once every two seconds, on page 3 twice.
The robot runs MicroPython. At power-on it runs main.py, which is just
import demo. demo.py
is the menu: a list of colours and programs.
MENU = [ # (colour, program)
(RED, run_touch_move),
((0, 0, 1), run_line_follower),
((0, 1, 0), run_hand_follower),
((1, 0, 1), run_remote),
]
A colour is (red, green, blue). (1, 0, 1) is purple. The update page sends each file
down the cable and checks a checksum so nothing gets lost.