Controlling Multiple LEDs with Arduino – Pre-Test | Lesson 6
1. What is the main advantage of using a for loop in Arduino code?
It saves lines of code and is easier to update
It uses more memory
It makes the LEDs brighter
2. What is the function of pinMode in the setup?
To set the pin as input or output
To send voltage to a pin
To read sensor values
3. What does delay(500) do?
Pauses the program for 0.5 seconds
Turns off the LED
Starts the program
4. Which loop structure is used to repeat a block of code a known number of times?
for loop
if statement
analogWrite
5. How do you set a digital pin to HIGH?
digitalWrite(pin, HIGH)
analogWrite(pin, 0)
pinMode(pin, HIGH)
6. If you reverse the pin order, what happens?
LEDs turn on and off in the opposite direction
Code will not compile
All LEDs will blink at once
7. What does increasing the number of LEDs require?
More pins and changes in loop range
Using analog pins only
Using smaller delay
8. What can you change to adjust LED speed?
Change the delay time
Use analogWrite
Use more LEDs
9. What do you need to do to add an LED to your circuit?
Connect it to a new digital pin and update your code
Use a second Arduino
Change the power supply
10. How can you make every second LED turn on while skipping the others?
Use a condition that only runs for even pin numbers
Set the delay to zero
Delete the for loop
11. In your own words, explain how you think a for loop could be used to control multiple LEDs connected to an Arduino. If you’re not sure, just describe what you think might happen when the code runs.
Submit