コード例 #1
0
ファイル: twinkle.py プロジェクト: mrsutherland/lightshow
        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))
コード例 #2
0
            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
ファイル: twinkle.py プロジェクト: mrsutherland/lightshow
            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:
コード例 #4
0
                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()