How the Wireless Controller Project Works
The radio call is similar to the countdown_transmitter project from Send and Receive Packets.
As usual, we want at least a 1-second pause before printing anything to make sure the browser terminal is ready. Then, instructions for the range of speeds you’ll use are printed.
The main loop starts with the input statements from terminal_controlled_bot_tethered_your_turn.
Next, the values are stored in a dictionary. This makes it easy because the receiver just has to do the reverse to get the vL, vR, and ms values back out of the dictionary it received. For more background on this, see the Dictionary Primer.
The dictionary is converted to a string named packet. That packet is displayed with a serial write statement and then transmitted with a call to radio send long string.