import lcd, image from modules import ws2812 from Led import LedStrip lcd.init(color=(255, 125, 0)) lcd.draw_string(50, 120, "Start", lcd.WHITE, lcd.RED) strip = LedStrip(6, 9) lcd.draw_string(50, 120, "Middle", lcd.WHITE, lcd.RED) strip.set(lcd, 255, 255, 255, i=2, display=True) lcd.draw_string(50, 120, "Finish", lcd.WHITE, lcd.RED)
from time import sleep import random from Led import LedStrip import math NUM_LEDS = 41 leds = LedStrip(6, NUM_LEDS) def RunningLights(red, green, blue, WaveDelay): Position = 0 for j in range(NUM_LEDS * 2): Position = Position + 1 for i in range(NUM_LEDS): leds.set(int(((math.sin(i + Position) * 127 + 128) / 255) * red), int(((math.sin(i + Position) * 127 + 128) / 255) * green), int(((math.sin(i + Position) * 127 + 128) / 255) * blue), i) leds.display() sleep(WaveDelay / 150) def loop(): RunningLights(0xff, 0, 0, 10) # red RunningLights(0xff, 0xff, 0xff, 10) # white RunningLights(0, 0, 0xff, 10) # blue try: loop()
from modules import ws2812 from time import sleep from Led import LedStrip import random n_leds = 41 leds = LedStrip( 6, n_leds ) leds.set( 0xff, 0xff, 0xff ) leds.display() def colors ( leds ): while True: leds.set(90, 0, 0) leds.display() sleep(1) leds.set(0, 90, 0) leds.display() sleep(1) def driver(leds): while True: colors(leds) sleep( 0.2 ) try: driver(leds) except Exception as e: print(e)
from Led import LedStrip from modes import * from time import sleep n_leds = 45 driver = LedStrip(6, n_leds) mode = RainbowCycle(driver) mode.enter_mode() while True: mode.update_mode()