You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
add time.py
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
from machine import Timer
|
||||
|
||||
# Callback function to be executed periodically
|
||||
def timer_callback(timer):
|
||||
print("Timer 500 triggered!")
|
||||
|
||||
# Initialize a timer
|
||||
timer = Timer(500) # Must be 0-20 on unix/desktop
|
||||
|
||||
# Set up a periodic timer (e.g., trigger every 1000ms)
|
||||
timer.init(period=1000, mode=Timer.PERIODIC, callback=timer_callback)
|
||||
Reference in New Issue
Block a user