WeatherShield sleep/power down - garbled serial [SOLVED]

Started by darkcurrent, July 14, 2015, 03:44:08 PM

darkcurrent

Hi all,
I have connected a WeatherShield board to a Moteino R4. To save battery, I would like to put the Moteino in power down mode using this code:  LowPower.powerDown(SLEEP_1S,ADC_OFF, BOD_OFF).
My problem is the following: once getting out of power down, data received by the serial terminal contain strange characters... I do not meet this problem if I keep the Moteino powered on, sampling Temp, RH and pressure every second.
Is there something particular about the use of WeatherShield board when putting the Moteino in sleep mode or power down mode ?

Thank you for your help!

Felix

You probably need to Serial.flush() before you go to sleep (and after perhaps). Try that and see if it fixes the issue.
There are examples that go into sleep and also read data from the WeatherShield: here is one.

TomWS

Quote from: Felix on July 14, 2015, 03:56:06 PM
You probably need to Serial.flush() before you go to sleep (and after perhaps). Try that and see if it fixes the issue.
There are examples that go into sleep and also read data from the WeatherShield: here is one.
I agree with Felix, definitely Serial.flush() before sleep, but if you also use Serial read, then do a Serial.flush() after waking as well.  This will eliminate any input garbage that 'collected' while sleeping...

Tom

darkcurrent

Following your advices, I added a Serial.flush() before setting the Moteino in sleep mode. It now works without problem!

Thanks to both of you! :)