LowPowerLab Forum

Hardware support => Low Power Techniques => Topic started by: xavier on November 04, 2016, 01:17:22 PM

Title: LowPower.powerDown never wakes up [solved]
Post by: xavier on November 04, 2016, 01:17:22 PM
I was inspired by this project https://lowpowerlab.com/2015/06/14/moteino-compost-sensor-network-adafruit-fona-gprs-relay/ (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:
Code: [Select]
  
//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
Title: Re: LowPower.powerDown question
Post by: Felix on November 04, 2016, 01:47:58 PM
What is i?
Title: Re: LowPower.powerDown question
Post by: xavier on November 04, 2016, 01:53:40 PM
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!
Title: Re: LowPower.powerDown question
Post by: Felix on November 04, 2016, 03:42:07 PM
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.