Threads

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
rhubarbdog
Posts: 168
Joined: Tue Nov 07, 2017 11:45 pm

Threads

Post by rhubarbdog » Fri Apr 27, 2018 7:52 am

There are hints on github and docs.micropython.org that the pyboard supports multi threaded programs.
I have tried the following

Code: Select all

import threading

Code: Select all

import _thread
and

Code: Select all

import thread
none of which worked.

Does pyboard support threads if so has anyone got a coding example

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Threads

Post by shaoziyang » Fri Apr 27, 2018 12:21 pm

First you need upgrad firmware with thread feature, then using import _thread.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Threads

Post by pythoncoder » Sun Apr 29, 2018 6:10 am

Indeed, on the download page there are prebuilt firmwares with threading enabled. If you possibly can, use uasyncio in preference. See here for reasons.
Peter Hinch
Index to my micropython libraries.

Post Reply