In loop(), the line digitalWrite(13, HIGH) is missing a semicolon at the end.
Step 2: Verify other parts
pinMode is correctly in setup(), delay() is allowed in loop(), and digitalWrite() has correct arguments.
Final Answer:
Missing semicolon after digitalWrite(13, HIGH) -> Option B
Quick Check:
Syntax error: missing semicolon = A [OK]
Hint: Look for missing semicolons after statements [OK]
Common Mistakes:
Putting pinMode in loop() unnecessarily
Thinking delay() is not allowed in loop()
Miscounting digitalWrite() arguments
5. You want to blink an LED connected to pin 9 exactly 5 times, then stop. Which modification to the Arduino sketch structure is best?
hard
A. Remove loop() function entirely
B. Put blinking code inside setup() and leave loop() empty
C. Use a counter variable in loop() and stop blinking after 5 times
D. Use delay(5000) in setup() to blink 5 times
Solution
Step 1: Understand blinking 5 times
Since loop() runs forever, use a counter variable inside loop() to count blinks.
Step 2: Evaluate options
Putting blinking code in setup() runs once, so it performs only one blink cycle, not 5. Removing loop() is invalid. Using delay(5000) only delays, does not blink 5 times.
Final Answer:
Use a counter variable in loop() and stop blinking after 5 times -> Option C
Quick Check:
Counter in loop() controls blink count = A [OK]
Hint: Use a counter in loop() to limit repetitions [OK]