예제 #1
0
        return response


if __name__ == '__main__':
    import time

    xbees = xbee_leds.get_xbee_list(True)
    if not xbees:
        raise Exception('No XBees found on network')
    eui = xbees[0]
    #initialize XBee
    xbee_leds.initialize()

    #turn off any leftover color
    compact = led.CompactLEDs()
    xbee_leds.send_compact_leds(compact.export(), eui)

    leds = []
    twinkles = []
    colors = [
        led.Color(red=0x0F),  #red
        led.Color(green=0x0F),  #green
        led.Color(blue=0x0F),  #blue
        led.Color(red=0xF, blue=0x0F),  #purple
        led.Color(green=0x0F, blue=0xF),  #teal
        led.Color(red=0x0F, green=0x8),  #yellow/orange
        led.Color(red=0x0E, green=0xE, blue=0xE)  #white
    ]
    for color in colors:
        for _ in range(5):
            twinkles.append(Twinkle(color))
            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()
예제 #3
0
            self.init_led()
        return response

if __name__ == '__main__':
    import time
    
    xbees = xbee_leds.get_xbee_list(True)
    if not xbees:
        raise Exception('No XBees found on network') 
    eui = xbees[0]
    #initialize XBee
    xbee_leds.initialize()
    
    #turn off any leftover color
    compact = led.CompactLEDs()
    xbee_leds.send_compact_leds(compact.export(), eui)
    
    leds = []
    twinkles = []
    colors = [led.Color(red=0x0F), #red
              led.Color(green=0x0F), #green
              led.Color(blue=0x0F), #blue
              led.Color(red=0xF, blue=0x0F), #purple
              led.Color(green=0x0F, blue=0xF), #teal
              led.Color(red=0x0F, green=0x8), #yellow/orange
              led.Color(red=0x0E, green=0xE, blue=0xE) #white
              ]
    for color in colors:
        for _ in xrange(5):
            twinkles.append(Twinkle(color))
    while True:
                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()