๐Ÿ“š Alvik lessons

Lesson 1 of 9 ยท about 15 minutes

๐Ÿ”ง Wake up the robot

Put this project's code on your Alvik from the browser, then meet the colour menu.

๐Ÿงฐ You need

This replaces the robot's menu program. Its three built-in programs stay. To go back, copy examples/demo onto the robot.

โ–ถ๏ธ Do it

  1. Close Arduino Lab for MicroPython if it is open.
  2. Open ๐Ÿ”ง Update the robot.
  3. Plug in the robot, press ๐Ÿ”Œ Connect USB and pick it.
  4. Optional: under โœจ Extras, tap ๏ผ‹ Add on any you like.
  5. Press โšก Update the robot. It restarts by itself.
  6. Lights go blue: that is the menu. Unplug it.

๐Ÿšฆ The colour menu

โฌ† โฌ‡ change colour, โœ“ runs it, โœ— goes back.

LightsProgramWhat it does
๐Ÿ”ด redTouch-moveTap arrows to line up moves, โœ“ to run them.
๐Ÿ”ต blueLine followerFollows a black line. The menu starts here.
๐ŸŸข greenHand followerKeeps about 10 cm from your hand.
๐ŸŸฃ purpleRemoteDrive it from a phone (lesson 2).
โšช white, ๐ŸŸก yellowโ€ฆYour extrasOne colour each.

Programs come in pages of six. On page 2 the light blinks once every two seconds, on page 3 twice.

๐Ÿ” How it works

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.

๐Ÿงช Try this