Skip to content

Instantly share code, notes, and snippets.

@CapacitorSet
Created January 28, 2016 08:34
Show Gist options
  • Save CapacitorSet/a3278ebc778c1e6f4436 to your computer and use it in GitHub Desktop.
Save CapacitorSet/a3278ebc778c1e6f4436 to your computer and use it in GitHub Desktop.
import serial
with serial.Serial("COM3", 9600) as ser:
while True:
s = ser.read()
if (s == b'o'):
print "Restart"
# Alive
ser.write(b'n')
elif (s == b'm'):
print "Ping"
# Pong
ser.write(b'l')
elif (s == b'y'):
print "Posizione iniziale"
elif (s == b'z'):
print "Inizia percorso"
else:
print s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment