from bibliopixel import LEDStrip, colors from bibliopixel.drivers.serial_driver import DriverSerial, LEDTYPE, ChannelOrder import time from bibliopixel import log log.setLogLevel(log.DEBUG) driver = DriverSerial(LEDTYPE.NEOPIXEL, 350, c_order=ChannelOrder.RGB) led = LEDStrip(driver, threadedUpdate=False) led.setMasterBrightness(192) try: while True: led.fill(colors.Red) led.update() time.sleep(0.5) led.fill(colors.Green) led.update() time.sleep(0.5) led.fill(colors.Blue) led.update() time.sleep(0.5) led.fill(colors.White) led.update() time.sleep(0.5) except KeyboardInterrupt: led.all_off() led.update()
pdx = SunRange() def nightRemainingRGB(): return (178, 102, 255) def nightFadedRGB(): return (76, 0, 153) def dayRemainingRGB(): return (255, 255, 51) def dayFadedRGB(): return (150, 150, 0) led_strip.fill(dayRemainingRGB()) led_strip.update() for i in range(0, num_leds): time.sleep(1) led_strip.fill(dayFadedRGB(), 0, i) led_strip.update() led_strip.fill(nightRemainingRGB()) led_strip.update() for i in range(0, num_leds): time.sleep(1) led_strip.fill(nightFadedRGB(), 0, i) led_strip.update()
print ('Press \'control + c\' to stop' ) year = 2014 months = ['January','February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] # In[11]: led.all_off() # All LEDs off. while True: for i, month in enumerate(months): print month, year #Set bottom panel led.fill((0,0,0),start=FirstLed_bottom, end=FinalLed_bottom) #print ((0,0,0),FirstLed_bottom, FinalLed_bottom) led.update() led_set(FirstLed_bottom, np.int(ledON[i]), color_gn_rd[np.int(color_disp[i])]) print(FirstLed_bottom, np.int(ledON[i]), color_gn_rd[np.int(color_disp[i])]) #ledON gives the number of LED's that will be turned on #color_disp specifies color #Turn all lights off top led.fill((0,0,0),start=FirstLed_top, end=FinalLed_top) #print((0,0,0),FirstLed_top, FinalLed_top) led.update() #Set top panel led_set(FirstLed_top + 2*np.int(np.floor(i/3)), 2, (200,150,100)) #print (FirstLed_top + 2*np.int(np.floor(i/3)), 2, (200,150,100))
year = 2014 months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ] # In[11]: led.all_off() # All LEDs off. while True: for i, month in enumerate(months): print month, year #Set bottom panel led.fill((0, 0, 0), start=FirstLed_bottom, end=FinalLed_bottom) #print ((0,0,0),FirstLed_bottom, FinalLed_bottom) led.update() led_set(FirstLed_bottom, np.int(ledON[i]), color_gn_rd[np.int(color_disp[i])]) print(FirstLed_bottom, np.int(ledON[i]), color_gn_rd[np.int(color_disp[i])]) #ledON gives the number of LED's that will be turned on #color_disp specifies color #Turn all lights off top led.fill((0, 0, 0), start=FirstLed_top, end=FinalLed_top) #print((0,0,0),FirstLed_top, FinalLed_top) led.update() #Set top panel