Toggle Navigation
Hatchery
Eggs
Rocket Launch
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import leds import ledfx import vibra import utime import display DISP_WIDTH = 160 DISP_HEIGHT = 80 disp = display.open() while True: with display.open() as disp: for rocket in range(0, 3): disp.clear() disp.update() leds.clear() disp.print('Rocket: %d' % int(rocket+1), posy=0) disp.print('Countdown', posy=20) disp.update() for countdown in range(10, -1, -1): if 10 - countdown < 4: leds.prep(countdown, [0, 255, 0]) if 10 - countdown < 8 and 10 - countdown >= 4: leds.prep(countdown, [255, 255, 0]) if 10 - countdown < 11 and 10 - countdown >= 8: leds.prep(countdown, [255, 0, 0]) leds.update() disp.print('%2d' % countdown, posx=60, posy=40) disp.update() utime.sleep(1) disp.clear() ledfx.kitt(cycles=10) vibra.vibrate(250) disp.print('OFF BLAST!', posx=10, posy=30) disp.update() for brightness in range(0, 32): leds.set_rocket(rocket, brightness) utime.sleep(0.03) for brightness in range(31, -1, -1): leds.set_rocket(rocket, brightness) utime.sleep(0.03) utime.sleep(0)