Dash Button - use interrupt for buttons

  • Any idea how to make use of the interrupts for the buttons? I want to exec an interrupt whenever one of the buttons is pressed. this way I avoid the button check on each loop. I used the std Arduino call, butt this didn't work :(

    void button_handler() {
    // code to exec when button pressed
    attachInterrupt(23, button_handler, RISING);

  • you can refer the InterruptCtrlLed example.

  • I tried this - this didn't work :( The Dash Button Keys are connected to pins
    23, 14, 10, 20. Do those support interrupts? I tried the InterruptCtrlLed example and replaced int button = 12; for int button = 23;. I wrapped this into OTA example for easier upload - could this be a problem?

  • pin10 does not support interrupt, pin 23, 14, 20 support interrupt.
    use INPUT_IRQ_FALL instead of INPUT_IRQ_RISE


  • Thanks, changing to INPUT_IRQ_FALL worked. To bad pin 10 doesn't have an IRQ attached :(

    weird thing I figured: with pin14 I get an irq when pressing AND releasing. for pin 23 and pin 20, just when pressing. why that?

  • I try it and same situation with you, the pin14 may not be stable for gpio irq use.

  • ah ok :( I see IRQ called once when pressing, but when I release button it's very bouncy - the IRC gets called up to 30 times, event value is either 2 or 1. I'll have to stabilize via software then...

Log in to reply

Looks like your connection to RAK Support Center was lost, please wait while we try to reconnect.