Arduino Mega 2560 Can we use more interrupts than 2?
-
Hi Guys,
I would like to implement Node that will be responsible for detecting LPG/CO/Smoke/Leak/Fire. As far as I know MySensor function "gw.sleep()" can deliver hardware interrupt just for two pins (standard). My question is: Can we use function that could handle more than 2 interrupts ? I would like to use my spare Arduino Mega 2560 (it has the ability to use 6x hardware based interrupts).
Looking forward for your reply
Thx Maciek
-
@macieiks I think the number of interrupts is dictated by the particular board (chip), not the MySensors library. Using gw(sleep) may not be applicable for your project. It is meant for low power applications and your list of sensors, in particular the gas sensors, may not be suitable for battery power. A mega with mains power would certainly work.
-
You can have CHANGE interrupts in any pins in the atmega328. See http://playground.arduino.cc/Main/PinChangeInterrupt
I haven't actually tested it, but it's in my list of things to try, as I want to have door/window sensors that monitor 4+ doors.
Edit: I went ahead and tested, it worked just copy and pasting the code from that page. The interrupt will wake up a atmega328p. You just will need to figure out what pin actually changed by remembering state.
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
LAN8720A - will mysensors work with this module
Development • 13 Nov 2024, 17:06 • Marcin 15 Nov 2024, 10:59 -
Home Assistant/MySensors quirks
Development • 17 Mar 2025, 02:35 • OldSurferDude 17 Mar 2025, 02:35 -
PJON and Minicore not working
Development • 21 Mar 2025, 19:51 • Trand 21 Mar 2025, 19:51 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
Counting Incoming and Outgoing Messages from a Gateway
Development • 10 Dec 2024, 21:57 • Trand 14 Dec 2024, 20:23