Toggle Navigation
Hatchery
Eggs
beedoo
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import badge import time import math import ugfx badge.init() badge.leds_init() ugfx.init() ugfx.clear(ugfx.BLACK) ugfx.flush() ugfx.clear(ugfx.WHITE) ugfx.flush() ugfx.clear(ugfx.BLACK) ugfx.flush() ugfx.clear(ugfx.WHITE) ugfx.flush() pos = 0 direction = 1 while True: m = 10 w = 0 pos = pos+direction if pos == 5: direction = -1 if pos == 0: direction = 1 duration = abs(math.cos(pos/5.0*math.pi))/5 r = int(duration*5*200) if pos <= 3 else 0 b = int(duration*5*200) if pos >= 2 else 0 g = 0 pad1 = [0]*pos*4 pad2 = [0]*(5-pos)*4 badge.leds_send_data(bytes(pad1+[g, r, b, w]+pad2), 24) time.sleep(duration)