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.


Log in to reply
 

Suggested Topics

  • 1
  • 5
  • 3
  • 1
  • 2
  • 1

16
Online

11.4k
Users

11.1k
Topics

112.7k
Posts