raspberry_pi_pico:micropython:threading
Ceci est une ancienne révision du document !
Exemple de code utilisant le multi-threading :
from time import sleep import _thread def th1(): counter = 0 while True: print("OOOOO") counter += 1 sleep(1) def th2(): counter = 0 while True: print("XXXXX") counter += 1 sleep(1) second_thread = _thread.start_new_thread(th2, ()) th1()
On ne peut pas lancer plus de deux thread à la fois.
raspberry_pi_pico/micropython/threading.1677481931.txt.gz · Dernière modification : 2023/02/27 08:12 de dan