Skip to content

Instantly share code, notes, and snippets.

@kevinmcaleer
Created June 20, 2022 23:52
Show Gist options
  • Save kevinmcaleer/940321352250ddf046b7802bebe3ed54 to your computer and use it in GitHub Desktop.
Save kevinmcaleer/940321352250ddf046b7802bebe3ed54 to your computer and use it in GitHub Desktop.
MicroPython v1.19 threads Demo
# threads demo
import _thread
from time import sleep
def hello():
for _ in range(10):
print("hello world")
sleep(0.5)
print('exiting')
_thread.exit()
def mainloop():
for _ in range(100):
print("main loop")
sleep(1)
_thread.start_new_thread(hello,())
mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment