Guest User

Untitled

a guest
Nov 23rd, 2020
34
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from machine import Timer
  2. global exit_flag
  3.  
  4. def on_timer(timer):
  5.     print("on_timer")
  6.     exit_flag == 1
  7. t = machine.Timer(1)
  8. t.init(mode=t.ONE_SHOT, period=3000, callback=on_timer)
  9. exit_flag = 0
  10. while(exit_flag == 0):
  11.     print("exit_flag:", exit_flag)
  12. t.deinit()
  13. print("Now out of while!")
RAW Paste Data