LowPower.powerDown never wakes up [solved]

Started by xavier, November 04, 2016, 01:17:22 PM

xavier

I was inspired by this project https://lowpowerlab.com/2015/06/14/moteino-compost-sensor-network-adafruit-fona-gprs-relay/ and built my own compost sensor but to maker a long story short, I'd like to have the sensor report temperature every hour.

In my loop I thought I would just do the following:
  
//439 for 1 hour?  SLeep_8S is 8192ms 
  for (i = 0; i< 439; i++)
     LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  sendCurrentThermistorTemp();


Now my question: this works fine if I loop only a couple of times (like say 2 or 3 times) but if I loop 400 times my sensor never wakes up it seems - did I miss something obvious? I'm on my way to switch things and use the DeepSleep example with the same kind of loop but maybe I'm just missing something...

thanks in advance!

X

Felix


xavier

oops my bad - that should have been the first I should have checked, it's defined as uint8_t, my bad, max value is 255!
Sorry for the noise!

Felix

Hehe, no problem. Happened to me a few times.
For those who will read this: if i is a byte (uint8_t), it will only count to 255 then back to 0 so loop exit condition will never happen.