Lesson 2 of 9 ยท about 20 minutes
Drive the robot over Bluetooth, then see what the page sends: five bytes at a time.
One remote at a time. While connected, nobody else can find the robot.
Every message is a packet of five bytes (numbers 0 to 255):
The last byte is a checksum: add the first four, flip the bits. If the robot's sum doesn't match, the packet got garbled and it is thrown away.
The check on the robot, in remote_control.py:
pkt = buf[i:i + 5]
if (~sum(pkt[:4])) & 0xFF != pkt[4]:
buf = buf[i + 1:] # damaged: look for the next '!'
continue