Home
Features
_Multi DropDown
__DropDown 1
__DropDown 2
__DropDown 3
_ShortCodes
_SiteMap
_Error Page
Mega Menu
Documentation
_Web Documentation
_Video Documentation
Privacy Policy
Daftar Isi
Beranda
Micropython Simple Clock
Micropython Simple Clock
Mei 04, 2022
Micropython Simple Clock
import tm1637 import time from machine import Pin tm = tm1637.TM1637(clk=Pin(5), dio=Pin(4)) #tombol=Pin(5, Pin.IN) led=Pin(2, Pin.OUT) tb=Pin(0, Pin.IN) hr=0 mn=0 sc=0 tdelay=0.95 status=0 while True: if (tb.value()==0): status=status+1 led.value(0) if (status>2): status=0 led.value(1) if (tb.value()==0 and status==1): mn=mn+1 tdelay=0.05 elif (tb.value()!=0 and status==1): tdelay=0.95 tm.numbers(hr, mn) time.sleep(tdelay) tm.write([0, 0, 0, 0]) sc=sc+1 if sc>=59: mn=mn+1 sc=0 if mn>=59: hr=hr+1 sc=0 mn=0 if hr>=24: hr=0 mn=0 sc=0
Social Plugin
ARTIKEL
3/recent/post-list
Facebook
Subscribe Us