Answers for "can i use thread in micropython"

5

create new thread python

from threading import Thread
from time import sleep

def threaded_function(arg):
    for i in range(arg):
        print("running")
        sleep(1)


if __name__ == "__main__":
    thread = Thread(target = threaded_function, args = (10, ))
    thread.start()
    thread.join()
    print("thread finished...exiting")
Posted by: Guest on June-27-2020
0

how to install threading module in python

pip install thread6
Posted by: Guest on August-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language