0
0
Arduinoprogramming~20 mins

LowPower library usage in Arduino - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
LowPower Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What 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
}
AStart\nWake up
BWake up\nStart
CStart
DWake up
Attempts:
2 left
💡 Hint
Think about what happens before and after the sleep function.
Predict Output
intermediate
2:00remaining
How 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() {}
A4 seconds
B2 seconds
C14 seconds
D8 seconds
Attempts:
2 left
💡 Hint
Add the sleep durations together.
Predict Output
advanced
2:00remaining
What 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);
}
ANo output, Serial.println causes no output because Serial not initialized
BCompilation error due to missing Serial.begin()
CPrints "Awake" every second
DRuntime error: LowPower library not initialized
Attempts:
2 left
💡 Hint
Think about what happens if Serial is used without initialization.
Predict Output
advanced
2:00remaining
What 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);
ABrown-out detector is disabled, saving power
BBrown-out detector triggers a reset immediately
CBrown-out detector causes a compilation error
DBrown-out detector stays on during sleep, consuming more power
Attempts:
2 left
💡 Hint
BOD stands for Brown-Out Detector.
🧠 Conceptual
expert
3:00remaining
Which option correctly describes the behavior of LowPower.idle() mode?
Select the statement that best describes what happens when the Arduino enters LowPower.idle() mode.
AAll clocks and peripherals are stopped, device consumes minimum power
BCPU is stopped but peripherals like timers and serial continue running
CCPU and ADC are stopped but timers continue running
DDevice resets immediately after entering idle mode
Attempts:
2 left
💡 Hint
Idle mode is the lightest sleep mode.