Ejemplo n.º 1
0
if sys.platform.startswith('win'):
    serialPorts = ['COM%s' % (i + 1) for i in range(256)]
elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'):
    # this excludes your current terminal "/dev/tty"
    serialPorts = glob.glob('/dev/tty[A-Za-z]*')
elif sys.platform.startswith('darwin'):
    serialPorts = glob.glob('/dev/tty.*')
else:
    raise EnvironmentError('Unsupported platform')

for thisPort in serialPorts:
    if 'usb' in thisPort:
        port = thisPort

bt = BlinkyTape(port)

storageFileName = 'lifeline.p'
tickTime = 0.01

# the format of the data will be:
# {
# 	'eventsById': {
# 		<id>: {
# 			'id': <id>,
# 			'date': <timestamp>
# 		}
# 	},
# 	'eventsByWeek': {
# 		<weekIndex>: {
# 			0: {