Toggle Navigation
Hatchery
Eggs
DIVD Badge
__init__.py
Users
Badges
Login
Register
__init__.py
raw
Content
# imports from machine import Pin from neopixel import NeoPixel from time import sleep import display import nvs colors = { 'none': (0, 0, 0), 'red': (255, 0, 0), 'green': (0, 255, 0), 'blue': (0, 0, 255), 'yellow': (250, 157, 0), 'purple': (110, 0, 108), 'white': (255, 255, 255) } # Pin 19 controls the power supply to SD card and neopixels powerPin = Pin(19, Pin.OUT) # Pin 5 is the LED's data line dataPin = Pin(5, Pin.OUT) # create a neopixel object for 5 pixels np = NeoPixel(dataPin, 5) # turn on power to the LEDs powerPin.on() display.drawFill(display.WHITE) display.drawText(18, 40, "DIVD", display.YELLOW, "roboto_regular18", 6, 6) display.drawText(28, 170, nvs.nvs_getstr('owner','nickname'), display.BLACK, "roboto_regular18", 2, 2) display.flush() def set_led(led, color): np[led] = color # send colors out to LEDs np.write() i = 0 while True: set_led(i, colors['yellow']) sleep(0.01) set_led(i, colors['none']) i = i+1 if i > 4: i = 0