DG21 panel buttons and interrupts.

Hi,

   pinMode(BTN_UP_PIN, INPUT_PULLUP);
    attachInterrupt(digitalPinToInterrupt(BTN_UP_PIN), onLowBtnUp, FALLING);  
    attachInterrupt(digitalPinToInterrupt(BTN_UP_PIN), onHighBtnUp, RISING); 

Why only last function is called ?

I would like to set flag on press and depress of the panel button.

Could you please give me some advice.

Artur

Artur
Artur
4
| 1 1 1
Asked on 10/25/18, 7:10 PM
0
vote
1860 Views

Hi, it seems you can only attach one interrupt to each pin. i suggest you change the mode to 'CHANGE' and that will fire the interrupt on falling and rising, and then in your ISR you can read the status of the pin to know whether it was falling or rising. https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/

Tom
Tom
5675
| 1 1 3
Answered on 10/26/18, 12:33 AM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

50 follower(s)

Stats

Asked: 10/25/18, 7:10 PM
Seen: 1860 times
Last updated: 10/26/18, 12:33 AM