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) tuple.
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 lobby():
# Preparatory phase on turn on:
ledstrip.fill(RED)
ledstrip.write()
# Listen to button presses
for i in range(5):
# Wait for button trigger
# value == 1 not pressed
# value == 0 pressed!
while p13.value():
pass
# Animation code using i as animation index:
ledstrip.fill(ALL_COLORS[i % len(ALL_COLORS)])
ledstrip.write()
sleep(0.5)
while not YDP.check_ready():
pass
game()
lobby()