Accessing buttons and switch of wio terminal with ardupy

I understand that the ardupy is still in early phase, for instance wifi and BLE librairies, and I am fine with that.

However I think it would be possible to easily provide access to the buttons and switch under ardupy.

The equivalent of WIO_KEY_A , WIO_KEY_B and WIO_KEY_C under Arduino. Just a pin HIGH or LOW.

Same for the switch.


I don’t know the answer but you might want to post this in the WIO Terminal section as well.

Hi @Losaure

Please refer to this:

1 Like
The link returns 404. This one can direct to the definitions.

404 ?

Yep, 404. I mean his link returns 404. Probably typo?

You’re right. The software has been updated until it has been adjusted.

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 (, the current Ardupy build does not include this option. When probing the Pin class functions and attributes only the following are listed:

object <class ‘Pin’> is of type type
init –
value –
off –
on –
IN – 0
OUT – 1

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?

Finally, how do we wrap other Arduino libraries (e.g.

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.

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.

Best Regards,

1 Like


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.


Thank you!

Currently, we don’t have a plan to add a wrapper to the ArduinoMenu library. However, we will let you know if we do so.

Best Regards,

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.

Finally, I know the code could be cleaner…


Using Circuitpython 6.0

import time
import board
from digitalio import DigitalInOut, Direction, Pull
from adafruit_debouncer import Debouncer

led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT

def setupWioButton(pinRef):
    pin = DigitalInOut(pinRef)
    pin.direction = Direction.INPUT
    pin.pull = Pull.UP
    button = Debouncer(pin)
    return button

buttonNames = ['A', 'B', 'C']
buttonList = [board.BUTTON_3, board.BUTTON_2, board.BUTTON_1]
buttonDict = {}

for i,b in enumerate(buttonNames):
    buttonDict[b] = setupWioButton(buttonList[i])

joyNames = ['DOWN', 'LEFT', 'PRESS', 'RIGHT', 'UP']
joyList = [board.SWITCH_DOWN,

joyDict = {}

for i,j in enumerate(joyNames):
    joyDict[j] = setupWioButton(joyList[i])

while True:
    for i,b in enumerate(buttonNames):
        curSwitch = buttonDict[b]
        if curSwitch.fell:
            print("Button %s Pressed"%b)
            led.value = True
            # print("LED ON")
        if curSwitch.rose:
            print("Button %s Released"%b)
            led.value = False
            # print("LED OFF")

    for i,j in enumerate(joyNames):
        curSwitch = joyDict[j]
        if curSwitch.fell:
            print("Joystick %s"%j)