Mercurial > code > home > repos > homeauto
diff service/garageArduino/garageArduino.py @ 849:67c03a3104f2
opening usb apparently causes an arduino restart now, so i have to wait for that to pass before beginning communications
Ignore-this: 9f34e8914c6bbe3fb54b2c8f5ed01804
darcs-hash:20121229125454-312f9-694b7893f6f25e2f6a99aefd27be3ac552e40747
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 29 Dec 2012 04:54:54 -0800 |
parents | edd2486d6e2c |
children | 69b214997213 |
line wrap: on
line diff
--- a/service/garageArduino/garageArduino.py Sun Dec 02 16:58:45 2012 -0800 +++ b/service/garageArduino/garageArduino.py Sat Dec 29 04:54:54 2012 -0800 @@ -35,7 +35,9 @@ class ArduinoGarage(object): def __init__(self, port='/dev/ttyACM0'): self.ser = LoggingSerial(port=port, baudrate=115200, timeout=1) + time.sleep(2) # wait for a arduino reset to pass self.ser.flush() + self.ping() def ping(self): self.ser.write("\x60\x00\x00") @@ -223,6 +225,7 @@ newData = ard.poll() except ValueError, e: print e + os.abort() else: self.lastPollTime = now self.lastValues = newData # for other data besides the blinks