I'm using an arduino mega 1280 and am running into a small issue. I enter sleep mode but cannot disable it once I enter sleep mode.
My code is the following:
int counter =0;
if (counter == 5)
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable(); // enables the sleep bit in the mcucr register
// so sleep is possible. just a safety pin
sleep_mode(); // here the device is actually put to sleep!!
// THE PROGRAM CONTINUES FROM HERE AFTER WAKING UP
sleep_disable(); // first thing after waking from sleep:
// disable sleep...
Serial.println("MCU is back in business");
My output is the following:
WORKING //Press the button to make sure interrupt is working BEFORE entering sleep mode
//I press the button as many times as I want but never seem to get any response from the arduino.
Can someone please tell me what I'm doing wrong ?