Mercurial > code > home > repos > homeauto
comparison service/garageArduino/garageArduino.py @ 13:33e6678d76ab
port change
Ignore-this: a352c3538b6fe208a4155895ee3bfc3c
author | drewp@bigasterisk.com |
---|---|
date | Sat, 03 Dec 2011 18:58:42 -0800 |
parents | 4c44c80a6a72 |
children | 90ff65ccd46b |
comparison
equal
deleted
inserted
replaced
12:3d26993558e8 | 13:33e6678d76ab |
---|---|
232 print "post error", msg, args | 232 print "post error", msg, args |
233 | 233 |
234 if __name__ == '__main__': | 234 if __name__ == '__main__': |
235 | 235 |
236 config = { # to be read from a file | 236 config = { # to be read from a file |
237 'arduinoPort': '/dev/ttyACM0', | 237 'arduinoPort': '/dev/serial/by-id/usb-Arduino__www.arduino.cc__Arduino_Uno_6493534323335161A2F1-if00', |
238 'servePort' : 9050, | 238 'servePort' : 9050, |
239 'pollFrequency' : 5, | 239 'pollFrequency' : 5, |
240 'boardName' : 'garage', # gets sent with updates | 240 'boardName' : 'garage', # gets sent with updates |
241 } | 241 } |
242 | 242 |
243 #from twisted.python import log as twlog | 243 #from twisted.python import log as twlog |
244 #twlog.startLogging(sys.stdout) | 244 #twlog.startLogging(sys.stdout) |
245 | 245 |
246 log.setLevel(logging.DEBUG) | 246 log.setLevel(logging.DEBUG) |
247 | 247 |
248 ard = ArduinoGarage() | 248 ard = ArduinoGarage(port=config['arduinoPort']) |
249 | 249 |
250 period = 1/config['pollFrequency'] | 250 period = 1/config['pollFrequency'] |
251 p = Poller(ard, period) | 251 p = Poller(ard, period) |
252 task.LoopingCall(p.poll).start(period) | 252 task.LoopingCall(p.poll).start(period) |
253 reactor.listenTCP(config['servePort'], Application(ard, p)) | 253 reactor.listenTCP(config['servePort'], Application(ard, p)) |