I understand microbit does not offer support for event handlers or for managing interrupts. Too bad, but the reasons are clear. However, the Button class contains functions which are interrupt driven (get presses(), is_pressed).
Would it be possible to do a little tweak in the Button class object to make it available on all GPIO pins?
This would allow the function .get_presses() to work as an interrupt counter, opening all sorts of great possibilities like doing RPM counters.
Please have a look at attached sample code.
What do you think? Would this work? Do I have to change this myself in the DAL (brrrr)?
Hi,
I understand microbit does not offer support for event handlers or for managing interrupts. Too bad, but the reasons are clear. However, the Button class contains functions which are interrupt driven (get presses(), is_pressed).
Would it be possible to do a little tweak in the Button class object to make it available on all GPIO pins?
This would allow the function .get_presses() to work as an interrupt counter, opening all sorts of great possibilities like doing RPM counters.
Please have a look at attached sample code.
What do you think? Would this work? Do I have to change this myself in the DAL (brrrr)?
Button class for any GPIO pin.txt