weird console output when using JeeLib/sleep

Hi guys.

I'm doing a project at the moment, where I need to focus on lowering the power consumption of the arduino, and for that I found the JeeLib (which is kinda similar to the sleep functions, I think?).

It works all fine and dandy, I'm using it to sleep the arduino for short amounts of time when no processing is needed. However, the serial output to the console, gets all weird when the code uses sleep instead of delays and whatever.

Like, if i do some code like this (this is just pseudo code)


the serial.print will look all weird in the console, like if you set the baut wrong. This does not happen with delay(1000).

I'm all new to all this lowering power consumption, so I might just overlook something obvious.
Anyone know how to fix it?

Anyone know how to fix it?

Stop sleeping. Or, understand what sleeping turns off that you need to turn back on when you wake up.

One thing you need to do is to NOT fall asleep when there is data in the outgoing serial buffer. You should call Serial.flush() before going to sleep. You might need to call Serial.begin() again when you wake up.