when the Interupt is called does that invoke the loop from the beginning?```
No, it resumes. But in your case, as sleep is your last function in Loop(), loop is relaunched.
I just quick looked at your code (no time).
Have you tried to remove others sensors code, and run a reedswitch only code.
It should be the first step in your debugging. Better do step by step to check what's the culprit.
If your reedswitch code is working ok, if there is any interference with other sensors/libraries, the logic order/algo etc.
Are you using sleep() for saving energy (so a batt powered device)?? then imho I would have choosen a better sensor. I don't get why people still uses these dht..
Eg. cheap si7021, Bosch BMEs : better power consumption, voltage range.
DHT libs has lot of delays, yuk!
eg. minimum 10ms just for a read start signal (more for the complete reading), imho it needs refactoring to be used in non blocking way.
So, you can:
- disable your DHT code and try reedswitch code only.
- if it works. then you have a problem with 1) your code logics 2) external lib (but imho it's a bad sensor choice)
- Check 1) by maybe changing a bit your code logics(order of functions calls like testing your reedswith right after your sleep call).
- if it doesn't fix, rewrite sensor lib in non blocking way to be used with your sketch
- if you don't feel enough good for rewriting lib, then change sensor brand/model, and you may fix this problem
As a rule of thumb, libs are not all well optimized even if their examples works, but sometimes it needs tinkering so it can work in larger projects like a mysensors multisensors sketch.
So before using a lib, I often check&fix if there are any delays/loops/blocking stuff and others details which could bring some problems and slow down my dev.
Edit: ahah I didn't notice, you beat me @mfalkvidd