Add blink helper

This commit is contained in:
Garrett Mills 2025-07-29 22:28:27 -05:00
parent c16f2516a7
commit 84d61b90a6

View File

@ -18,6 +18,12 @@ class Pin:
def on(self): def on(self):
io.output(self.pin, io.LOW if self.off_mode == io.HIGH else io.HIGH) io.output(self.pin, io.LOW if self.off_mode == io.HIGH else io.HIGH)
def blink(self, blinks, blink_time_s):
for _ in range(0, blinks):
self.on()
time.sleep(blink_time_s)
self.off()
pins = { pins = {
"red": Pin(27), "red": Pin(27),
"yellow": Pin(22), "yellow": Pin(22),
@ -28,9 +34,6 @@ pins = {
def reset(): def reset():
for name, pin in pins.items(): for name, pin in pins.items():
pin.setup() pin.setup()
pin.off() pin.blink(3, 0.3)
pin.on()
time.sleep(1)
pin.off()
reset() reset()