0

I'm using seep sleep mode with UNO with a simple sketch that turning on an LED and then goes to sleep. as far as the ATmega328p datasheet in sleep mode part showing the wake up sources and deactivated clock sources in deep sleep mode and the I/O clock becomes deactivate so we expect when the board goes to sleep the LED should become off because of no clock. but it doesn't happen and LED keeps ON in sleep mode. what is the problem?7 and how can we even find out that the board is on sleep mode or not?enter image description here

enter image description here

2
  • Why do you think, that the output will be turned off, when going to sleep? As of my understanding, the value of the pin cannot change in sleep, since the latch does not have a clock signal. But that doesn't mean, that the output is turned off.
    – chrisl
    Mar 24, 2020 at 13:29
  • use the LED to indicate sleep mode ... turn off led upon wakup
    – jsotola
    Mar 24, 2020 at 21:08

2 Answers 2

2

The IO doesn't require the clock to keep its current state. It only requires it to change state.

There is no real external signal provided by the chip to indicate if its in sleep mode or not. However you could monitor the current consumption of the chip and when it drops below a certain threshold you can assume that it is in sleep mode.

0

You could easily set the LED output LOW just before you call going_to_sleep(), and set it HIGH when going_to_sleep() returns. There would be two short periods where the LED signal would indicate sleeping but the processor is running:

  1. between the LED going LOW and the processor actually entering sleep; and
  2. between the processor waking and the LED going HIGH.

But at these times the processor could not respond to your external system anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.