Toggle Navigation
Hatchery
Eggs
36C3
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import ugfx, badge, time, appglue badge.init() ugfx.init() ugfx.clear(ugfx.BLACK) ugfx.flush() ugfx.clear(ugfx.WHITE) ugfx.flush() ugfx.set_lut(ugfx.LUT_FULL) badge.eink_png(0, 0, '/lib/36c3/36c3.png') ugfx.flush(0xff) badge.eink_busy_wait() # deepsleep.start_sleeping(60000) # def close(pressed): # if pressed: # deepsleep.reboot() def quit(pressed): if(pressed): appglue.start_app("") ugfx.flush() leds_array = bytes(24) badge.leds_init() badge.leds_enable() def nextled(): badge.leds_send_data(leds_array) time.sleep(0.3) # https://wiki.sha2017.org/w/Projects:Badge/MicroPython color = [1,5,0,0] yellow = [1,1,0,0] red = [0,4,0,0] black = [0,0,0,0] def yellowled(leds_array): badge.leds_send_data(leds_array) time.sleep(0.0005) def redled(leds_array): badge.leds_send_data(leds_array) time.sleep(0.001) # value how long a LED is on display = 150; def ledone(): count = 1; while count < display: yellowled(bytes(yellow + black + black + black + black + black)) redled(bytes(red + black + black + black + black + black)) count += 1 def ledtwo(): count = 1; while count < display: yellowled(bytes(black + yellow + black + black + black + black)) redled(bytes(black + red + black + black + black + black)) count += 1 def ledthree(): count = 1; while count < display: yellowled(bytes(black + black + yellow + black + black + black)) redled(bytes(black + black + red + black + black + black)) count += 1 def ledfour(): count = 1; while count < display: yellowled(bytes(black + black + black + yellow + black + black)) redled(bytes(black + black + black + red + black + black)) count += 1 def ledfive(): count = 1; while count < display: yellowled(bytes(black + black + black + black + yellow + black)) redled(bytes(black + black + black + black + red + black)) count += 1 def ledsix(): count = 1; while count < display: yellowled(bytes(black + black + black + black + black + yellow)) redled(bytes(black + black + black + black + black + red)) count += 1 while True: ledone() ledtwo() ledthree() ledfour() ledfive() # ledsix() # ledfive() ledfour() ledthree() ledtwo() # leds_array = bytes([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + color) # nextled() # leds_array = bytes([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + color + [0,0,0,0]) # nextled() # leds_array = bytes([0,0,0,0,0,0,0,0,0,0,0,0] + color + [0,0,0,0,0,0,0,0]) # nextled() # leds_array = bytes([0,0,0,0,0,0,0,0] + color + [0,0,0,0,0,0,0,0,0,0,0,0]) # nextled() # leds_array = bytes([0,0,0,0] + color + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]) # nextled() # leds_array = bytes(color + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]) # nextled() # leds_array = bytes([0,0,0,0] + color + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]) # nextled() # leds_array = bytes([0,0,0,0,0,0,0,0] + color + [0,0,0,0,0,0,0,0,0,0,0,0]) # nextled() # leds_array = bytes([0,0,0,0,0,0,0,0,0,0,0,0] + color + [0,0,0,0,0,0,0,0]) # nextled() # leds_array = bytes([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + color + [0,0,0,0]) # nextled() # leds_array = bytes(yellow + yellow + yellow + yellow + yellow + yellow) # badge.leds_send_data(leds_array) # time.sleep(0.0005) # leds_array = bytes(red + red + red + red + red + red) # badge.leds_send_data(leds_array) # time.sleep(0.001)