import YDP
import neopixel
import _thread
from machine import Pin
from time import sleep, sleep_us, time_ns
NUM_PIXELS = 15
p13 = Pin(13, Pin.IN, Pin.PULL_UP)
ledstrip = neopixel.NeoPixel(Pin(4), NUM_PIXELS)
# Colors variable list. Every color is an (Red, Green, Blue) tupple.
YELLOW = (200, 200, 0)
PURPLE = (95, 68, 150)
ORANGE = (128, 64, 0)
GREEN = (0, 200, 0)
RED = (200, 0, 0)
BLUE = (0, 0, 200)
WHITE = (200, 200, 200)
OFF = (0, 0, 0)
PINK = (199, 76, 176)
CYAN = (76, 180, 199)
ALL_COLORS = [RED, ORANGE, YELLOW, GREEN, CYAN, BLUE, PURPLE, PINK, WHITE, (123, 20, 60)]
def game():
exit()
def my_animation_1(seconds: int) -> None:
n = 15 # number of times to run the animation
x = seconds / n # time to sleep between iterations
for i in range(n):
# set all pixels to red
ledstrip.fill(RED)
ledstrip.write()
sleep(x)
# set all pixels to green
ledstrip.fill(GREEN)
ledstrip.write()
sleep(x)
# set all pixels to blue
ledstrip.fill(BLUE)
ledstrip.write()
sleep(x)
print("playing animation 1...")
sleep(1)
# turn off all pixels at the end of the animation
ledstrip.fill(OFF)
ledstrip.write(4)
pass
while True:
if p13.value(10):
pass
else:
my_animation_1(10)
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
rgb0:VDD
rgb0:DOUT
rgb0:VSS
rgb0:DIN
rgb1:VDD
rgb1:DOUT
rgb1:VSS
rgb1:DIN
rgb2:VDD
rgb2:DOUT
rgb2:VSS
rgb2:DIN
rgb3:VDD
rgb3:DOUT
rgb3:VSS
rgb3:DIN
rgb4:VDD
rgb4:DOUT
rgb4:VSS
rgb4:DIN
rgb5:VDD
rgb5:DOUT
rgb5:VSS
rgb5:DIN
rgb6:VDD
rgb6:DOUT
rgb6:VSS
rgb6:DIN
rgb7:VDD
rgb7:DOUT
rgb7:VSS
rgb7:DIN
rgb8:VDD
rgb8:DOUT
rgb8:VSS
rgb8:DIN
rgb9:VDD
rgb9:DOUT
rgb9:VSS
rgb9:DIN
rgb10:VDD
rgb10:DOUT
rgb10:VSS
rgb10:DIN
rgb11:VDD
rgb11:DOUT
rgb11:VSS
rgb11:DIN
rgb12:VDD
rgb12:DOUT
rgb12:VSS
rgb12:DIN
rgb13:VDD
rgb13:DOUT
rgb13:VSS
rgb13:DIN
rgb14:VDD
rgb14:DOUT
rgb14:VSS
rgb14:DIN
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r