Created
June 20, 2022 23:52
-
-
Save kevinmcaleer/940321352250ddf046b7802bebe3ed54 to your computer and use it in GitHub Desktop.
MicroPython v1.19 threads Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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