import machine
from machine import Pin, SoftI2C
import time
from oled import I2C
i2c = SoftI2C(scl=Pin(22), sda=Pin(21))
oled = I2C(128, 64, i2c)
button = Pin(4, Pin.IN, Pin.PULL_DOWN)
led_pins = [14, 27, 26, 25, 33, 32, 23, 18, 16, 19]
leds = [Pin(pin, Pin.OUT) for pin in led_pins]
state = False
last = 0
while True:
current = button.value()
if current == 1 and last == 0:
state = not state
if state:
for led in leds:
led.on()
oled.fill(0)
oled.text("we love eddie", 0, 0)
oled.text("XD", 0, 2)
oled.show()
else:
for led in leds:
led.off()
oled.fill(0)
oled.show()
last = current
time.sleep(0.05)