Bird
0
0

Which of the following is the correct way to read the state of GPIO pin 18 as an input?

easy📝 Conceptual Q2 of 15
Raspberry Pi - GPIO Basics with Python
Which of the following is the correct way to read the state of GPIO pin 18 as an input?
AGPIO.read(18)
BGPIO.output(18)
CGPIO.input(18)
DGPIO.setup(18, GPIO.OUT)
Step-by-Step Solution
Solution:
  1. Step 1: Identify the function to read input

    GPIO.input(pin) reads the current state of the specified pin.
  2. Step 2: Check other options

    GPIO.output sets pin output, GPIO.setup configures pin mode, GPIO.read does not exist.
  3. Final Answer:

    GPIO.input(18) -> Option C
  4. Quick Check:

    Read input with GPIO.input(pin) [OK]
Quick Trick: Use GPIO.input(pin) to read input pin state [OK]
Common Mistakes:
  • Using GPIO.output to read input
  • Confusing setup with reading
  • Using non-existent GPIO.read function
  • Not specifying pin number

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes