Toggle Navigation
Hatchery
Eggs
draw line
__init__.py
Users
Badges
Login
Register
__init__.py
raw
Content
# code copied from DIVD app in event related 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.BLACK) display.drawText(18, 40, "COPS", display.YELLOW, "roboto_regular18", 6, 6) display.drawText(28, 170, nvs.nvs_getstr('owner','nickname'), display.WHITE, "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