Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is the purpose of the pinMode() function in an Arduino LED blink program?
The pinMode() function sets a specific pin as an input or output. For blinking an LED, it sets the pin connected to the LED as an output so it can send voltage to turn the LED on or off.
Click to reveal answer
beginner
What does the digitalWrite() function do in an LED blink pattern?
The digitalWrite() function sends a HIGH or LOW signal to a pin. Sending HIGH turns the LED on by providing voltage, and LOW turns it off by removing voltage.
Click to reveal answer
beginner
Why do we use the delay() function in an LED blink pattern?
The delay() function pauses the program for a set number of milliseconds. This pause keeps the LED on or off long enough for us to see the blink.
Click to reveal answer
beginner
What is the role of the loop() function in Arduino programs?
The loop() function runs repeatedly after setup(). It allows the LED blink pattern to repeat forever, turning the LED on and off continuously.
Click to reveal answer
beginner
How can you change the speed of the LED blinking?
You change the speed by adjusting the number inside the delay() function. Smaller numbers make the LED blink faster, bigger numbers make it blink slower.
Click to reveal answer
Which Arduino function sets a pin as output for an LED?
AanalogRead()
BdigitalWrite()
CpinMode()
Ddelay()
✗ Incorrect
pinMode() sets the pin mode to output or input. For blinking an LED, it must be set to output.
What does digitalWrite(pin, HIGH) do in an LED blink program?
ATurns the LED off
BTurns the LED on
CSets the pin as input
DPauses the program
✗ Incorrect
digitalWrite(pin, HIGH) sends voltage to the pin, turning the LED on.
Why do we use delay(1000) in an LED blink pattern?
ATo read sensor data
BTo set pin mode
CTo turn LED off
DTo pause the program for 1 second
✗ Incorrect
delay(1000) pauses the program for 1000 milliseconds (1 second), keeping the LED on or off long enough to see.
Which function runs repeatedly to keep the LED blinking?
Aloop()
Bsetup()
CdigitalWrite()
DpinMode()
✗ Incorrect
loop() runs over and over, allowing the LED blink pattern to repeat.
How do you make the LED blink faster?
ADecrease the delay time
BIncrease the delay time
CChange pinMode to INPUT
DUse analogWrite()
✗ Incorrect
Decreasing the delay time makes the LED turn on and off faster, so it blinks faster.
Explain the basic steps to create an LED blink pattern on an Arduino board.
Think about how to turn the LED on and off repeatedly with pauses.
You got /6 concepts.
How can you change the blink speed of an LED in your Arduino code?
Focus on the delay function controlling timing.
You got /3 concepts.
Practice
(1/5)
1. What does the delay(1000); command do in an Arduino LED blink program?
easy
A. Pauses the program for 1000 milliseconds (1 second)
B. Turns the LED on for 1000 milliseconds
C. Turns the LED off for 1000 milliseconds
D. Sets the LED brightness to 1000
Solution
Step 1: Understand the delay function
The delay() function pauses the program for the given time in milliseconds.
Step 2: Interpret the argument 1000
1000 milliseconds equals 1 second, so the program waits for 1 second before continuing.
Final Answer:
Pauses the program for 1000 milliseconds (1 second) -> Option A
Quick Check:
delay(1000) = 1 second pause [OK]
Hint: delay(ms) pauses program for ms milliseconds [OK]
Common Mistakes:
Thinking delay turns LED on or off
Confusing delay time with brightness
Assuming delay is in seconds
2. Which of the following is the correct syntax to set pin 13 as an output in Arduino?
easy
A. pinMode(OUTPUT, 13);
B. pinMode(13, OUTPUT);
C. digitalWrite(13, OUTPUT);
D. digitalWrite(OUTPUT, 13);
Solution
Step 1: Recall pinMode syntax
The correct syntax is pinMode(pin, mode); where pin is the pin number and mode is INPUT or OUTPUT.
Step 2: Match the correct order
pinMode(13, OUTPUT); uses pinMode(13, OUTPUT); which matches the correct order and parameters.
Final Answer:
pinMode(13, OUTPUT); -> Option B
Quick Check:
pinMode(pin, OUTPUT) sets pin as output [OK]
Hint: pinMode(pin, OUTPUT) sets pin as output [OK]
Common Mistakes:
Swapping pin and mode parameters
Using digitalWrite instead of pinMode to set mode
Missing semicolon at end
3. What will be the output of this Arduino code snippet?
D. digitalWrite(13, HIGH); delay(500); digitalWrite(13, LOW); delay(500); delay(2000);
Solution
Step 1: Understand the blink pattern
The LED should blink twice quickly (short on/off), then pause 2 seconds before repeating.
Step 2: Analyze each option's timing
for(int i=0; i<2; i++) { digitalWrite(13, HIGH); delay(200); digitalWrite(13, LOW); delay(200); } delay(2000); blinks twice with 200 ms on and off delays, then pauses 2000 ms. This matches the pattern.
Step 3: Check other options
digitalWrite(13, HIGH); delay(200); digitalWrite(13, LOW); delay(200); delay(2000); blinks once only. for(int i=0; i<2; i++) { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); } delay(2000); blinks twice but with 1 second delays (too slow). digitalWrite(13, HIGH); delay(500); digitalWrite(13, LOW); delay(500); delay(2000); blinks once with 500 ms delays.