Toggle Navigation
Hatchery
Eggs
binclock
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import wifi, time, ntp, system, audio, display COLOR = 0x005f00 display.drawFill(0x000000) display.flush() def displaydigit(colom,digit): for bit in range(4): if digit & (1<<bit): display.drawPixel(3-bit, colom, COLOR) def testdisplay(): for v_hour in range(23): for v_min in range (59): display.drawFill(0x000000) displaydigit(0,int(v_hour / 10)) displaydigit(1,v_hour % 10) displaydigit(2,int(v_min / 10)) displaydigit(3,v_min % 10) time.sleep(5) display.flush() if not wifi.status(): audio.play('/cache/system/wifi_connecting.mp3') wifi.connect() wifi.wait() if not wifi.status(): audio.play('/cache/system/wifi_failed.mp3') time.sleep(6) system.launcher() while 1: ntp.set_NTP_time() t_hour = time.localtime()[3] t_min = time.localtime()[4] #t_sec = time.localtime()[5] #testing #testdisplay() display.drawFill(0x000000) displaydigit(0,int(t_hour / 10)) displaydigit(1,t_hour % 10) displaydigit(2,int(t_min / 10)) displaydigit(3,t_min % 10) display.flush() time.sleep(20)