Complete the code to set the microcontroller to sleep mode.
MCUCR = (1 << [1]);
The SM1 bit in MCUCR register selects the sleep mode.
Complete the code to enable sleep mode by setting the sleep enable bit.
MCUCR |= (1 << [1]);
The SE bit enables the sleep mode when set.
Fix the error in the code to correctly put the MCU to sleep.
sleep_cpu(); MCUCR &= ~(1 << [1]);
After waking up, the SE bit should be cleared to disable sleep mode.
Fill both blanks to create a dictionary of power modes and their descriptions.
const char* power_modes[] = {"Idle", "Power-down", "Power-save", "Standby"};
const char* descriptions[] = {"CPU stopped", "Most devices off", "Timer running", [1];
const char* mode = power_modes[2];
const char* desc = descriptions[[2]];The description for "Standby" mode is "Lowest power mode" and index 2 corresponds to "Power-save" mode.
Fill all three blanks to complete the function that configures and enters sleep mode.
void enter_sleep_mode() {
MCUCR = (1 << [1]); // Set sleep mode
MCUCR |= (1 << [2]); // Enable sleep
[3](); // Enter sleep
MCUCR &= ~(1 << [2]); // Disable sleep after wakeup
}Set SM1 bit to select sleep mode, set SE bit to enable sleep, call sleep_cpu() to enter sleep, then clear SE after waking.
