Skip to content

Instantly share code, notes, and snippets.

@dansteingart
Created July 17, 2013 13:53
Show Gist options
  • Save dansteingart/6020732 to your computer and use it in GitHub Desktop.
Save dansteingart/6020732 to your computer and use it in GitHub Desktop.
import serial
from glob import glob
from time import sleep
port = glob("/dev/tty.usb*")[0]
ard = serial.Serial(port,57600)
print "waiting to start"
for i in range(3,0,-1):
print i,
sleep(1)
print "starting"
ard.timeout = .1
a = ard.inWaiting()
print a
ard.write("s")
while True:
stringer = ""
while ard.inWaiting() > 0:
stringer += ard.read()
print stringer
sleep(0.05)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment