Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 10 months ago.
deepsleep() isn't working as expected
Using the following code in FRDM-KL25Z:
include the mbed library with this snippet
#include "mbed.h"
#include "rtos.h"
DigitalOut ledr(LED_RED);
Ticker t;
void isro(void)
{
ledr = !ledr;
}
int main()
{
ledr = 0;
t.attach(&isro, 3.0);
deepsleep();
}
It works as expected soon as I restart the board using the board button (it keeps turning on and off the LED at 3 seconds intervals). If I remove USB and plug it again, it keeps the LED on and doesn't work anymore. Does anyone knows why it stops to work if I unplug and plug the power of the board ?
PS: If I change deepsleep() to sleep() it works fine.
Question relating to:
2 Answers
10 years, 10 months ago.
Try Erik's WakeUp library instead of using the Ticker.
https://developer.mbed.org/users/Sissors/code/WakeUp/
10 years, 10 months ago.
Hi,
one thing to be said, Ticker does not have any requirement to wake up from deep_sleep(). it's true for most of platforms. Look at Paul above suggested , at WakeUp timer, which on the other hand , is using low power timers.