Nano doesn't want to sleep ?
I never used 'sleep' before because all my nodes were powered from 220ac outlets.
Now I have a new node which will be powered by a battery.
The node only needs to wakeup when PIR motion is detected and do some actions.
I tried : sleep(PIR1 - 2, CHANGE, 0);
It doesn't seem to work. Node does not sleep and Nano consumes +-40mA as before the sleep command...
but also simply sleep(50000) does not put my Nano to sleep.
Does the sleep command need to be at the end of the void loop() code (as in most examples ?)
What am I overlooking ?
PS : I use the code IdleTimeNow = millis(); just before putting the sleep command ... could that be the reason ?
@DirkB19 adding a serial debug print after the sleep will make it easy to see if the code stops at sleep or not.
To get the most battery life, use a Pro Mini or Sensebender. See https://www.mysensors.org/build/battery for more details.
Measure the power consumption of the pir. Maybe that's the component using most of the power (depends on which pir you are using)
Hi and thanks for the tips.
I didnt think of the PIR indeed.
But anyways, the nano isn't sleeping because I get serial debug back from it after the sleep command.