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
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/
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!
Keep Informed
About This Forum
This community is for professionals and enthusiasts of our products and services.
Read GuidelinesQuestion tools
Stats
Asked: 10/25/18, 7:10 PM |
Seen: 2144 times |
Last updated: 10/26/18, 12:33 AM |