from led import Color, CompactLEDs import xbee_leds if __name__ == '__main__': xbees = xbee_leds.get_xbee_list(True) if not xbees: raise Exception('No XBees found on network') eui = xbees[0] #initialize ZigBee driver xbee_leds.initialize() # create gradient leds = CompactLEDs() leds.gradients([(0, Color(red=0xF)), (17, Color(green=0xF)), (34, Color(blue=0xF)), (0, Color(red=0xF)) ]) while True: # shift all of the leds by one color = leds.pop() leds.insert(0, color) # send led colors xbee_leds.send_compact_leds(leds.export(), eui) # make sure we don't try to send too fast while xbee_leds.queue_size(eui) > 3: time.sleep(0.01)
if start and stop: times.append((start, stop, scale, thrum, bell, warble)) except: pass #ignore headers, blank lines, and others strand = CompactLEDs() xbees = xbee_leds.get_xbee_list(True) if not xbees: raise Exception('No XBees found on network') eui = xbees[0] xbee_leds.initialize() if mp3play and os.path.exists(MUSIC_FILE): clip = mp3play.load(MUSIC_FILE) clip.play() start_time = time.time() for start, stop, scale, thrum, bell, warble in times: #prepare LED values set_leds(strand, scale, thrum, bell, warble) #wait until time to send while time.time() < start_time + start: time.sleep(.001) #send LED values xbee_leds.send_compact_leds(strand.export(), eui) xbee_leds.send_compact_leds(CompactLEDs().export(), eui) #turn off lights at end. if clip: clip.stop() xbee_leds.close()
import time from led import Color, CompactLEDs import xbee_leds if __name__ == '__main__': xbees = xbee_leds.get_xbee_list(True) if not xbees: raise Exception('No XBees found on network') eui = xbees[0] #initialize ZigBee driver xbee_leds.initialize() # create gradient leds = CompactLEDs() leds.gradients([(0, Color(red=0xF)), (17, Color(green=0xF)), (34, Color(blue=0xF)), (0, Color(red=0xF))]) while True: # shift all of the leds by one color = leds.pop() leds.insert(0, color) # send led colors xbee_leds.send_compact_leds(leds.export(), eui) # make sure we don't try to send too fast while xbee_leds.queue_size(eui) > 3: time.sleep(0.01)
times.append((start, stop, scale, thrum, bell, warble)) except: pass #ignore headers, blank lines, and others strand = CompactLEDs() xbees = xbee_leds.get_xbee_list(True) if not xbees: raise Exception('No XBees found on network') eui = xbees[0] xbee_leds.initialize() if mp3play and os.path.exists(MUSIC_FILE): clip = mp3play.load(MUSIC_FILE) clip.play() start_time = time.time() for start, stop, scale, thrum, bell, warble in times: #prepare LED values set_leds(strand, scale, thrum, bell, warble) #wait until time to send while time.time() < start_time + start: time.sleep(.001) #send LED values xbee_leds.send_compact_leds(strand.export(), eui) xbee_leds.send_compact_leds(CompactLEDs().export(), eui) #turn off lights at end. if clip: clip.stop() xbee_leds.close()