alextaujenis / RBD_Button

Arduino Button Library - Read and debounce buttons and switches without delay or interrupts.
https://robotsbigdata.com/docs-arduino-button.html
MIT License
32 stars 9 forks source link

Question #8

Closed Bwanna closed 5 years ago

Bwanna commented 6 years ago

My sketch uses RBD in normal use of my sketch and it works great! (Thanks!)

I'm planning on adding code to place it into Sleep Mode so only the INT0 or INT1 will wake it.

Question: Without resetting the Arduino through any of this, can I use attachInterrupt() just prior to sleeping and detachInterrupt() just after waking without a conflict occurring with the RBD assignment?

alextaujenis commented 5 years ago

This library stores an internal reference to the pin number and calls digitalRead(_pin) on each loop to report if the button is pressed or not. I don't think attaching or detaching interrupts would interfere with the pin binding.