Toggle Navigation
Hatchery
Eggs
cat
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import display import time import neopixel import buttons leds = 12 colors = [[0, 25, 25],[25,0,25],[8,25,8]] no_colors = [[0, 0, 0],[0,0,0],[0,0,0]] use = colors def leds_on(pressed): global use use = colors def leds_off(pressed): global use use = no_colors def print_cat(x): display.drawFill(0x000000) display.drawPng(x,0,'/apps/cat/cat.png') display.flush() time.sleep(0.1) def print_nyan(): for x in range(0,3): display.drawFill(0x000000) display.drawPng(0,0,'/apps/cat/nyan%s.png' % (x+1)) display.flush() all_leds(use[x]) time.sleep(0.1) def all_leds(colors): temp = [colors[0], colors[1], colors[2]] * 12 neopixel.send(bytes(temp)) buttons.attach(buttons.BTN_UP, leds_on) buttons.attach(buttons.BTN_DOWN, leds_off) while True: print_nyan()