remove light program lol
This commit is contained in:
parent
9feeaddd79
commit
b0c2636569
2 changed files with 0 additions and 28 deletions
28
leds.py
28
leds.py
|
@ -244,32 +244,6 @@ class Adafruit_CharLCD:
|
|||
else:
|
||||
self.write4bits(ord(char), True)
|
||||
|
||||
def defaultPattern(n, t):
|
||||
return ((n + t) % 255, (n + t) % 255, (n + t) % 255)
|
||||
|
||||
class LightStrip:
|
||||
def __init__(self, data_pin = board.D18, string_length = 300, brightness = 1, pixel_order = neopixel.GRB):
|
||||
self.data_pin = data_pin
|
||||
|
||||
self.np = neopixel.NeoPixel(self.data_pin, string_length, brightness = brightness, auto_write=True, pixel_order = pixel_order)
|
||||
self.pattern = defaultPattern
|
||||
self.cur_tick = 0
|
||||
|
||||
def set_light_level(self, level):
|
||||
self.np.brightness = level
|
||||
def pattern(self, pattern_callback):
|
||||
self.pattern = pattern_callback
|
||||
|
||||
def tick(self):
|
||||
np = self.np
|
||||
t = self.cur_tick
|
||||
n = np.n
|
||||
for i in range(n):
|
||||
col = self.pattern(i, t)
|
||||
if np[i] != col:
|
||||
np[i] = col
|
||||
self.cur_tick = t + 1
|
||||
|
||||
debug_statements = True
|
||||
|
||||
|
||||
|
@ -297,7 +271,6 @@ def color(lcd):
|
|||
|
||||
def loop():
|
||||
lcd = Adafruit_CharLCD()
|
||||
lights = LightStrip()
|
||||
level = 0
|
||||
level_max = 14
|
||||
idle = 0
|
||||
|
@ -308,7 +281,6 @@ def loop():
|
|||
query_level = querylightlevel()
|
||||
idle = idle + 1
|
||||
debug("idle value: {}".format(idle))
|
||||
lights.tick()
|
||||
if query_level != level:
|
||||
level = query_level
|
||||
lights.set_light_level(level / level_max)
|
||||
|
|
0
light_manager.py
Normal file
0
light_manager.py
Normal file
Loading…
Reference in a new issue