add time.py

This commit is contained in:
Thomas Farstrike
2025-05-26 11:11:13 +02:00
parent f8477d9f3f
commit 25f60d922d
2 changed files with 21 additions and 0 deletions
+11
View File
@@ -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)