comparison service/garageArduino/garageArduino.py @ 818:ccbff2a4b8ce

port change Ignore-this: a352c3538b6fe208a4155895ee3bfc3c darcs-hash:20111204025842-312f9-7fb240e134b0b6518213c3ea1862049a023375fd.gz
author drewp <drewp@bigasterisk.com>
date Sat, 03 Dec 2011 18:58:42 -0800
parents 44e1ca03ddf1
children 90ff65ccd46b
comparison
equal deleted inserted replaced
817:fb1bcdc55ca4 818:ccbff2a4b8ce
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))