Bird
0
0

Why is it important to call GPIO.cleanup() at the end of a Raspberry Pi traffic light simulation program?

hard📝 Conceptual Q10 of 15
Raspberry Pi - LED and Button Projects
Why is it important to call GPIO.cleanup() at the end of a Raspberry Pi traffic light simulation program?
ATo speed up the program execution
BTo reset GPIO pins and avoid warnings on next run
CTo turn off the Raspberry Pi automatically
DTo save the program output to a file
Step-by-Step Solution
Solution:
  1. Step 1: Understand GPIO resource management

    GPIO.cleanup() resets all GPIO pins used, freeing them for future use.
  2. Step 2: Avoid warnings and conflicts

    Without cleanup, running the program again may cause warnings or errors due to pins still in use.
  3. Final Answer:

    To reset GPIO pins and avoid warnings on next run -> Option B
  4. Quick Check:

    GPIO.cleanup() resets pins for safe reuse [OK]
Quick Trick: Always call GPIO.cleanup() to reset pins [OK]
Common Mistakes:
  • Thinking cleanup speeds execution
  • Assuming it powers off the Pi
  • Confusing cleanup with file saving

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes