Sleep forever without INTERRUPT, how?
-
According to Sleeping-section here
http://www.mysensors.org/download/sensor_api_15#the-full-apiI need to use this
bool sleep(int interrupt, int mode, unsigned long ms=0);
if I want to sleep forever
I tried with out interrupt and mode but if I put 0 as ms it sleeps for 0 ms.I can of course use 10000000000000 ms but if there is a function for sleep forever it is much better to use that.
Why cant I use 0 like this
void sleep(unsigned long ms);
Anyone know?
-
@flopp You can use sleep(0, FALLING, 0); and just do not trigger the interrupt pin.
But why would you wait forever? Can 't you just power off?
-
I am building a sketch like this and as soon as i touch the pin it restarts
http://forum.mysensors.org/topic/3355/count-car-starts
And dont want to power off after each start. I SLEEP_TIME to 24 hours
-
@flopp using while(1) {} will also implement a wait-for-ever but will NOT cause the processor to save battery power but if you do NOT run on batteries this does not matter. The only way to get out this loop is a reset.
while ( 1 ) { }
-
@BartE
Thanks that will be very useful in my sketch
I am not running batteries