This issue doesn’t seem to be resolved as there is not a well documented example. In short, the key aspect that appears missing is the concept of interrupts. As opposed to the core micropython Pin definition, which includes interrupts and handlers (http://docs.micropython.org/en/v1.9.3/esp8266/esp8266/tutorial/pins.html), the current Ardupy build does not include this option. When probing the Pin class functions and attributes only the following are listed:
help(Pin)
object <class ‘Pin’> is of type type
init –
value –
off –
on –
IN – 0
OUT – 1
PULL_UP – 2
PULL_DOWN – 3
IRQ_RISING – 4
IRQ_FALLING – 3
IRQ_CHANGE – 2
So the core question remains, in order to make the Wio Terminal functional with the included buttons, what is the plan to get handlers and interrupts working?
Other suggestings include: MQTT, Wifi, and a read/write CSV file from SD card. Please, please make this happen. It is a nice little unit with loads of potential.
Hi,
We will bring the external interrupts/ handlers feature to ArduPy in the near future.
Also to answer your second question, you could convert the existing Arduino library to an ArduPy library by following our guide. It is available as a wiki and also as a video.
Finally as per your suggestions, currently the mentioned features such as MQTT, Wi-Fi, and SD card usage are only available to use with Arduino. But we will think about adding these features into ArduPy as well.
I’m glad to hear these items are on the docket. Having some solid examples using interrupts would greatly expand the utility. As I’m sure you are aware CircuitPython does not support interrupts. Please don’t go down that route. A key concept with microcontrollers is obviously the capacity to switch tasks immediately. Keep up the good work. Any chane you all could add a wrapper to the ArduinoMenu library? That could be a slick way to build in some simple UI concepts.
For those interested, here is a solution using Circuitpython. The only required library not included in the distribution is the debounce library. Works reasonably well. To get this to work with Ardupy, I had to put in the exact pin numbers which was a real pain–it was for this reason that after coding up the 2nd button I bailed on that approach. Until regular updates occur with Ardupy, I’m gonna work with Circuitpython. However, I’d love to have true interrupts with the micropython support.