
Meowster - Stomp Activated LED Code
import board
import neopixel
from adafruit_circuitplayground import cp
from rainbowio import colorwheel
import time
from adafruit_led_animation.animation.sparkle import Sparkle
PINK = (255, 5, 5)
CYAN = (0, 0, 255)
REALCYAN = (0,255,255)
CYANRGBW = (0, 255, 255, 0)
PINKRGBW = (255, 5, 5, 0)
# SHOE
pixel_pin = board.A1
pixel_num = 30
ORDER = neopixel.GRBW
# CALF
chase_pixel_pin = board.A2
chasepixel_num = 20
Footpixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=1, auto_write=False, pixel_order=ORDER)
chasePixels = neopixel.NeoPixel(chase_pixel_pin, chasepixel_num, brightness=1, auto_write=False)
sparkleCalf = Sparkle(chasePixels, speed=0.003, color=REALCYAN, num_sparkles=1)
def color_chase(color, wait):
for i in range(chasepixel_num):
chasePixels[-i-1] = color
time.sleep(wait)
chasePixels.show()
time.sleep(.01)
while True:
while True:
if cp.shake(shake_threshold=12):
time.sleep(0.1)
#light up the foot PINK
Footpixels.fill(PINKRGBW)
Footpixels.show()
time.sleep(0.3)
#btm to top PINK up the calf
color_chase(PINK, 0.01)
time.sleep(0.05)
#top of calf PINK
cp.pixels.fill(PINK)
time.sleep(0.5)
#turn off all LEDs and reset back to blue
chasePixels.fill((0,0,0))
chasePixels.show()
Footpixels.fill((0,0,0,0))
Footpixels.show()
else:
#when not walking, this is the default
#shoe BLUE
Footpixels.fill(CYANRGBW)
Footpixels.show()
#top of calf BLUE
cp.pixels.fill(REALCYAN)
#calf is sparkling BLUE
sparkleCalf.animate(CYANRGBW)
chasePixels.fill((0,0,0))
chasePixels.show()