esp32 micropython timer code example
Example: esp32 micropython timer
from machine import Timer
tim0 = Timer(0)
def my_callback_function(timer): # important (timer)
# do something
tim0.init(period = 1000, mode = Timer.ONE_SHOT, callback = my_callback_function)
# other mode : Timer.PERIODIC
tim0.deinit() # stop timer