sleep() in MySensors 2.2.0
I have read about a long discussion about sleep() in MySensors with @AWI and @Yveaux discussing that for PIR sensors sleep must be used with "LOW" interrupt according to atmega328p spec. However, I did try it and it just does not work. If I change
sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
to anything like
sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), LOW, SLEEP_TIME);
my PIR stops working.
I cannot use smartSleep() as I have Domoticz.
What's the final verdict? How sleep function has to be used please?
If you set it on "high"?
@alexsh1 it is a bug in the atmega datasheet that only certain levels can be used. Change should also work, although it might give two wakes for each trigger.
Make sure to use mySensors 2.2.x as some issues with waking from sleep by interrupts have been fixed.
@gohan I have not tried it. All I can say is that LOW does not work for PIRs. At least in my setup
@yveaux thank you!