Esempio n. 1
0
def main():
    """ Demo code """
    dev = blink1.open()
    blink(dev, 3, 255, 0, 0)
    blink1.close(dev)
		color['blue'] = color['green'] = 0
            ###online
            elif body.find('personastate": 1') >= 0 and body.find('gameextrainfo":') < 0:
                color['blue'] = 0xff
		color['red'] = color['green'] = 0
	    ###busy
            elif body.find('personastate": 2') >= 0 and body.find('gameextrainfo":') < 0:
		color['red'] = color['blue'] = 0xff
		color['green'] = 0
	    ### away/snoooze
            elif (body.find('personastate": 3') >= 0 or body.find('personastate": 4') >= 0) and body.find('gameextrainfo":') < 0:
		color['red'] = color['blue'] = 0xff
		color['green'] = 0
	    ###possible to be 'away' and in a game..
            elif body.find('gameextrainfo":') >= 0 and body.find('personastate": 1') >= 0:
	        color['green'] = color['blue'] = 0xff
            elif body.find('gameextrainfo":') >= 0:
                color['green'] = 0xff
	    ###in-a-game, or something else...
            else:
		color['red'] = color['green'] = color['blue'] = 0xff
            
            blink1.fadeToRGB(dev, 900, color['red'], color['green'], color['blue'])
            time.sleep(2)
    f.close()
    blink1.fadeToRGB(dev,900, 0x00, 0x00, 0x00)
    time.sleep(5)
    blink1.close(dev)