Bird
0
0

Why is it important to call GPIO.setmode() before setting pin modes on a Raspberry Pi?

hard📝 Conceptual Q10 of 15
Raspberry Pi - GPIO Basics with Python
Why is it important to call GPIO.setmode() before setting pin modes on a Raspberry Pi?
AIt disables all pins until setup is complete
BIt selects the pin numbering system (BCM or BOARD) for all GPIO operations
CIt automatically cleans up previous pin settings
DIt initializes the pins to output mode by default
Step-by-Step Solution
Solution:
  1. Step 1: Understand GPIO numbering modes

    GPIO.setmode() chooses between BCM (Broadcom chip numbering) or BOARD (physical pin numbering).
  2. Step 2: Importance of setting mode first

    All pin references depend on this mode, so it must be set before configuring pins.
  3. Final Answer:

    It selects the pin numbering system (BCM or BOARD) for all GPIO operations -> Option B
  4. Quick Check:

    setmode defines pin numbering scheme [OK]
Quick Trick: Always call GPIO.setmode before setup [OK]
Common Mistakes:
  • Skipping setmode call
  • Assuming it sets pin modes automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes