๐Ÿ“š Alvik lessons

Lesson 4 of 9 ยท about 20 minutes

๐Ÿ“ก The robot talks back

Now the robot sends news back, and a 3D robot on the screen copies the real one.

๐Ÿงฐ You need

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

โ–ถ๏ธ Do it

  1. Point the robot away from you, then connect.
  2. Turn it on the spot. The 3D robot turns too, wheels and all.
  3. Press ๐Ÿ’ก Lights and ๐Ÿชฉ Disco. The 3D robot copies them.
  4. If the two get out of line, point the robot away from you and tap ๐Ÿงญ.

๐Ÿ” How it works

On connect, the page asks ! T 1: "tell me what you are doing". Then about eight times a second the robot sends a ten-byte telemetry packet:

21start !54letter T7B 00heading17distance24lights41speed00turn03switches90checksum
BytesMeansHere
7B 00Heading, tenths of a degree, left = up12.3ยฐ left
17Distance ahead, cm (255 = nothing)23 cm
24Lights: a bit each for R, G, B, left then rightboth blue
41Speed, fifths of a cm/s13 cm/s
00Turning, 3ยฐ/s stepsnot turning
03Turbo, bumper, blocked, dancingturbo, bumper

Heading comes from odometry: counting how far each wheel has turned. No compass.

๐Ÿงช Try this

โœ๏ธ Change it

On the robot, TELEMETRY_MS = 100 sets how often it sends news. Try 500 and watch the 3D robot move in steps.