Design question about using interrupts or not



  • Hi All,

    Since this is my first post I would like to thank all who made MySensors possible!

    In my development environment I have several setups as a proof of concept with all kind of sensors, relays, LCD and so on. It works great and I am about to begin in designing a number of permanent nodes but have some thoughts about whether or not use interrupts.

    The node I am working on is based on a Nano and NRF24 radio. On this node there will be following connected: DHT22, DS18b20, LDR(analog), 2 relays and 4 reed switches.

    The 4 reed switched are to monitor some doors. A reaction time on those switches of about 0.5 second is enough(i think). So my question is; Should I use interrupts or is it better to (semi) continuously check the switches and occaisionally check and report the other sensors.

    I know I could use interrupts but since there are doors to monitor and not several 10.000rpm tacho's I would like to keep it as simple as possible.

    Please let me know if you have some thoughts on this.

    Kind regards,
    Gerard


  • Mod

    Welcome to the forum @gerard-van-seventer!
    If the nodes have a permanent power supply (not batteries), checking the switches will be sufficient. You can probably check them every millisecond if you want - a millisecond is a long time for a microcontroller.



  • Thanks @mfalkvidd for your quick reply.
    Indeed it isn't battery powered. I already have a millis() delay loop so checking the swithes is easy then.
    Thanks again!


 

288
Online

7.6k
Users

8.5k
Topics

91.3k
Posts