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
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
Echo request is not set
Troubleshooting • 12 Aug 2024, 15:36 • kamilb85 3 Sept 2024, 08:58 -
Forum Search not working?
Troubleshooting • 4 Oct 2023, 23:33 • Gibber 2 Sept 2024, 20:28 -
Can not compile MySensors on esp8266
Troubleshooting • 24 Aug 2024, 15:35 • TheoL 29 Aug 2024, 20:47 -
NODs stop responding, but ping works.
Troubleshooting • 28 days ago • Marcin 28 days ago -
JSN-SR04T-V3.0 Coax cable extended
Troubleshooting • 17 days ago • bocalexandru 15 days ago