Multiple buttons, one interrupt
-
I have a battery-powered sensor that I want to sleep as much as possible. The trouble is that I have two door sensors that I want to keep track of using interrupts, but only one interrupt pin available (interrupt 0 is used by the radio on my moteino, I think). Is it possible to use the pinChangeInt library to have the sensor wake from gw.sleep() in some way, or is this only possible using the hardware interrupt pins? Is there any other way I can wake on one or more buttons/reed switches using only one interrupt?
Thanks.
-
@kolaf Here's a way to accomplish that: http://www.gammon.com.au/forum/?id=11091.
Cheers
-
@Sparkman Many thanks, but using "or" doesn't allow me to detect if the second switch is pulled low after the first switch is pulled low, since the interrupt will already be low. I was thinking that maybe some kind of XOR function would work since it would change the output whenever any input changes. However, I'm not exactly sure how to implement this, especially not for more than two switches (if the XOR function is even defined for more than two inputs). Also, my arsenal is currently pretty limited, I only have resistors (although I suspect I will have to change this at some point, but not in the middle of Easter).
-
@kolaf Also, Google pinchageint which is a library that I believe allows for more interrupts..
Cheers
Al
Suggested Topics
-
Update RF24 library to latest version
Bug Reports • 23 Mar 2014, 23:37 • andriej 24 Mar 2014, 22:52 -
Code Garage to the rescue.
General Discussion • 11 Jan 2025, 11:25 • skywatch 23 Feb 2025, 14:57 -
is this project dead?
General Discussion • 3 days ago • perfectom 3 days ago -
Which device I have to use to connect with accelerometer before connecting to my pc?
General Discussion • 24 Jan 2023, 17:16 • Yada Kijsathan 28 days ago -
Email notifications received twice
General Discussion • 6 Feb 2023, 16:15 • Jodaille 18 days ago -
Why is the output of ACS712 current measurement module unchanged?
General Discussion • 19 Jul 2021, 09:09 • Tessie T 15 days ago