Since the last post, I have set up a raspberry pi and connected it to the arduino over usb. I configured wifi on the raspberry pi and I’ve written a simple python script to control the rover.
Now, I can ssh into the raspberry pi, launch the python script and I can remotely control the rover using the same keys from the arduino sketch (‘l’ for left, ‘r’ for right, etc.).
Here is the python script to control the arduino.
with serial.Serial('/dev/ttyACM0', 115200, timeout=2) as ser:
time.sleep(2) # wait for arduino to boot
x = input("cmd:> ")
if x in ['l', 'r', 'c', 'f', 'b', 'k']:
The code is pretty simple. It opens a connection to the arduino (/dev/ttyACM0) and loops forever. When a valid key is entered, (l, r, c, f, b, k), it sends it to the arduino and the arduino processes the command. Then the loop repeats.
Next, I will start adding sensors and possibly a camera.