0
0
Arduinoprogramming~10 mins

Why power matters for battery projects in Arduino - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the LED pin as output.

Arduino
void setup() {
  pinMode([1], OUTPUT);
}

void loop() {
  // LED control code
}
Drag options to blanks, or click blank then click option'
A7
B13
CA0
D12
Attempts:
3 left
💡 Hint
Common Mistakes
Using analog pins like A0 instead of digital pins.
Choosing pins not connected to the LED.
2fill in blank
medium

Complete the code to turn the LED on.

Arduino
void loop() {
  digitalWrite(13, [1]);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}
Drag options to blanks, or click blank then click option'
ALOW
BINPUT
CHIGH
DOUTPUT
Attempts:
3 left
💡 Hint
Common Mistakes
Using LOW instead of HIGH to turn on the LED.
Confusing pin modes with output values.
3fill in blank
hard

Fix the error in the code to correctly read battery voltage on analog pin A0.

Arduino
int sensorValue = analogRead([1]);
float voltage = sensorValue * (5.0 / 1023.0);
Drag options to blanks, or click blank then click option'
A13
BA0
CA1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'A0' as a string instead of 0.
Using digital pin numbers for analogRead.
4fill in blank
hard

Fill both blanks to calculate battery voltage with a voltage divider.

Arduino
float batteryVoltage = sensorValue * ([1] / 1023.0) * ([2] + 10.0) / 10.0;
Drag options to blanks, or click blank then click option'
A5.0
B3.3
C20.0
D15.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong reference voltage.
Incorrect resistor values in formula.
5fill in blank
hard

Fill all three blanks to print battery voltage with 2 decimal places.

Arduino
Serial.print("Battery Voltage: ");
Serial.print([1], [2]);
Serial.println([3]);
Drag options to blanks, or click blank then click option'
AbatteryVoltage
B2
C" V"
Dvoltage
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable name.
Forgetting to print the unit.