commit 69a01879c01797e753ddab0b58ecac5538e80466 Author: Correl Date: Sun Mar 12 22:11:40 2023 -0400 Initial commit diff --git a/README.org b/README.org new file mode 100644 index 0000000..36fa461 --- /dev/null +++ b/README.org @@ -0,0 +1,4 @@ +#+title: GIRL Sign + +A MicroPython application to control a cheap, rewired LED locker sign that says +"GIRL". diff --git a/boot.py b/boot.py new file mode 100644 index 0000000..53ecedd --- /dev/null +++ b/boot.py @@ -0,0 +1,79 @@ +import time + +from machine import Pin + +D1 = 5 +D2 = 4 +D3 = 0 +D4 = 2 +D5 = 14 + + +class Girl: + def __init__( + self, p_g: int = D1, p_i: int = D2, p_r: int = D3, p_l: int = D5 + ) -> None: + self.pins = [ + Pin(p_g, Pin.OUT), + Pin(p_i, Pin.OUT), + Pin(p_r, Pin.OUT), + Pin(p_l, Pin.OUT), + ] + for pin in self.pins: + pin.off() + + def show(self, text: str) -> None: + for pin, value in zip( + self.pins, + [ + int("g" in text), + int("i" in text), + int("r" in text), + int("l" in text), + ], + ): + pin.value(value) + + def on(self) -> None: + for pin in self.pins: + pin.on() + + def off(self) -> None: + for pin in self.pins: + pin.off() + + +separate = [ + "g", + "", + "i", + "", + "r", + "", + "l", + "", +] + +flash = [ + "girl", + "", + "girl", + "", + "girl", + "", +] +gradual = [ + "g", + "gi", + "gir", + "girl", + "", +] + +sign = Girl(D1, D2, D3, D5) + +while True: + for pattern in [separate, flash, gradual, gradual, flash]: + for state in pattern: + sign.show(state) + time.sleep(0.5)