jimmo wrote: ↑Sun Oct 27, 2019 11:10 pm
The micro:bit uses a different version of MicroPython -- based on v1.9.2
https://github.com/bbcmicrobit/micropython
Because it's such a small microcontroller and because it's targeted at education, a lot of features are not available, including interrupts.
Depending on how adventurous you're feeling, you can actually compile the upstream version of MicroPython for micro:bit --
https://github.com/micropython/micropyt ... /ports/nrf which will give you access to some core features like interrupts, but you will lose some other features. And you probably won't be able to use Mu, etc.
What are you trying to do, perhaps we can find a way to do it without interrupts? (I've spent a lot of time teaching with the micro:bit and while we certainly did find the lack of interrupts frustrating, we did find a lot of ways around that limitation too).
Hi Jim. I realize this was a post from pretty far back, and a few things might've changed since then, but I have been looking for a way to incorporate interrupts into my code, too. I have a micro:bit v2, but I still don't think that interrupts have been made accessible by means of the standard micro:bit micropython version (at least, I haven't found documentation for constructing an ISR, though I did see that the API shows how to disable/enable IRQs).
I had a few questions I was wonderining if I could ask you.
You attached the link to the "upstream" micropython version. I went to the micro:bit folder, and the json file says that the code was written for the micro:bit v1. Is there a version of code for the micro:bit v2? Also, what features would you lose if you were to use this version of micropython, and what all features would you gain aside from interrupts?
My final question was: what methods do you implement to get around the limitation? I saw that you said you have spent a lot of time teaching with the micro:bit, so any tips, techniques, etc. you'd be willing to share would be highly appreciated.
I am seeking to construct ISRs that are triggered by pins being pulled to digital high. I have considered simply using an if statement that checks the pins' states in an infinite while loop, but I desire to have some level of priority. The micro:bit V2 is pretty fast, at 64MHz, so the if statements would probably work, but I know that using interrupts would be the most efficient approach to what I want to do.
Thanks much.