Bird
0
0

Which of the following is the correct Python syntax to turn on an LED connected to GPIO pin 17 on a Raspberry Pi?

easy📝 Syntax Q12 of 15
Raspberry Pi - LED and Button Projects
Which of the following is the correct Python syntax to turn on an LED connected to GPIO pin 17 on a Raspberry Pi?
AGPIO.input(17, GPIO.HIGH)
BGPIO.output(17, GPIO.HIGH)
CGPIO.setup(17, GPIO.HIGH)
DGPIO.read(17, GPIO.HIGH)
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct function to set output value

    GPIO.output(pin, value) sets the voltage level on the pin, turning the LED on or off.
  2. Step 2: Confirm the correct parameters

    Pin 17 is the GPIO pin, and GPIO.HIGH sets the pin to high voltage (turns LED on).
  3. Final Answer:

    GPIO.output(17, GPIO.HIGH) -> Option B
  4. Quick Check:

    Use GPIO.output to set pin level = A [OK]
Quick Trick: Remember: output sets pin voltage, input reads pin state [OK]
Common Mistakes:
  • Using GPIO.input to set pin value
  • Confusing GPIO.setup with output
  • Using GPIO.read which does not exist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes