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 -
Which device I have to use to connect with accelerometer before connecting to my pc?
General Discussion • 24 Jan 2023, 17:16 • Yada Kijsathan 16 Mar 2025, 20:17 -
Why is the output of ACS712 current measurement module unchanged?
General Discussion • 19 Jul 2021, 09:09 • Tessie T 29 Mar 2025, 16:30 -
No merge into master in the last 5 years, should we use development?
General Discussion • 23 Sept 2024, 17:48 • kiesel 25 Mar 2025, 15:30 -
Email notifications received twice
General Discussion • 6 Feb 2023, 16:15 • Jodaille 27 Mar 2025, 06:07 -
Meet in Malmö, Summer 2016?
General Discussion • 1 Feb 2016, 15:34 • bjacobse 4 Mar 2025, 00:29