def showTreeStatus(): status = getTreeStatus() if status == 'open': blink.shine(0x00, 0xff, 0x00) elif status == 'closed': blink.shine(0xff, 0x00, 0x00) else: blink.shine(0xff, 0xff, 0x00)
def showPercentage(batteryPercentage): print 'Battery is at %s%%' % batteryPercentage batteryFraction = batteryPercentage / 100 blink.shine(0xff * (1 - batteryFraction), 0xff * batteryFraction, 0x00)