Challenge - 5 Problems
LowPower Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWhat is the output after running this Arduino sketch?
Consider the following Arduino code using the LowPower library. What will be printed to the serial monitor after the device wakes up from sleep?
Arduino
#include <LowPower.h> void setup() { Serial.begin(9600); delay(1000); // Wait for serial to initialize Serial.println("Start"); LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF); Serial.println("Wake up"); } void loop() { // Empty loop }
Attempts:
2 left
💡 Hint
Think about what happens before and after the sleep function.
✗ Incorrect
The code prints "Start" first, then goes to sleep for 2 seconds. After waking up, it prints "Wake up".
❓ Predict Output
intermediateHow long does the Arduino sleep in this code?
Given this code snippet using the LowPower library, how many seconds will the Arduino sleep before waking up?
Arduino
#include <LowPower.h>
void setup() {
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF);
LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF);
}
void loop() {}Attempts:
2 left
💡 Hint
Add the sleep durations together.
✗ Incorrect
The Arduino sleeps for 8 + 4 + 2 seconds sequentially, totaling 14 seconds.
❓ Predict Output
advancedWhat error occurs when calling LowPower.powerDown() without setup() initialization?
What will happen if you call LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF) inside loop() without calling Serial.begin() or any setup initialization?
Arduino
void setup() {
// Empty setup
}
void loop() {
LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF);
Serial.println("Awake");
delay(1000);
}Attempts:
2 left
💡 Hint
Think about what happens if Serial is used without initialization.
✗ Incorrect
Serial.println() will not output anything because Serial.begin() was never called, but no compilation or runtime error occurs.
❓ Predict Output
advancedWhat is the effect of BOD_ON in LowPower.powerDown()?
In the LowPower library, what happens if you use BOD_ON instead of BOD_OFF in the powerDown() function?
Arduino
LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_ON);
Attempts:
2 left
💡 Hint
BOD stands for Brown-Out Detector.
✗ Incorrect
BOD_ON keeps the brown-out detector active during sleep, which uses more power but protects against low voltage resets.
🧠 Conceptual
expertWhich option correctly describes the behavior of LowPower.idle() mode?
Select the statement that best describes what happens when the Arduino enters LowPower.idle() mode.
Attempts:
2 left
💡 Hint
Idle mode is the lightest sleep mode.
✗ Incorrect
In idle mode, the CPU stops but peripherals like timers and serial communication keep running, allowing quick wake-up.
