I need to run a function every 200ms so here is some code. Am I on the right way ?
Code: Select all
def tick(timer):
global master_timer
if master_timer == 1:
print("Alert") # exit/reset/....
master_timer = 1
def main():
global master_timer
master_timer = 0
tim = pyb.Timer(4, freq = 5)
tim.callback(tick)
while True:
if master_timer == 1:
#
# --- My function here ---
#
master_timer = 0
# feed a watchdog ?