Toggle Navigation
Hatchery
Eggs
card10 Flashlight
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import color, leds, buttons, display with display.open() as disp: disp.clear() disp.print("Flashlight", fg=color.WHITE, bg=color.BLACK, posx=10, posy=10) disp.print("ON", fg=color.WHITE, bg=color.BLACK, posx=10, posy=50) disp.print("OFF", fg=color.WHITE, bg=color.BLACK, posx=110, posy=50) disp.update() disp.close() while True: pressed = buttons.read( buttons.BOTTOM_LEFT | buttons.BOTTOM_RIGHT ) if pressed & buttons.BOTTOM_LEFT != 0: leds.set_all([color.WHITE] * 11) leds.dim_top(8) if pressed & buttons.BOTTOM_RIGHT != 0: leds.set_all([color.BLACK] * 11)