Answers for "micropython esp32 hardware timer example"

2

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
Posted by: Guest on September-12-2020

Python Answers by Framework

Browse Popular Code Answers by Language