Bird
0
0

Which of the following is the correct syntax to create an LED object on GPIO pin 17 using gpiozero?

easy📝 Syntax Q3 of 15
Raspberry Pi - gpiozero Library
Which of the following is the correct syntax to create an LED object on GPIO pin 17 using gpiozero?
Aled = LED(17)
Bled = LED(pin_factory=17)
Cled = gpiozero.LED(17)
Dled = LED(GPIO17)
Step-by-Step Solution
Solution:
  1. Step 1: Recall gpiozero LED creation syntax

    The LED class is imported and instantiated by passing the pin number directly.
  2. Step 2: Check options

    led = LED(17) uses correct syntax: led = LED(17). led = LED(pin_factory=17) uses an unsupported keyword argument. led = gpiozero.LED(17) is incorrect without import prefix. led = LED(GPIO17) uses undefined GPIO17.
  3. Final Answer:

    led = LED(17) -> Option A
  4. Quick Check:

    LED creation syntax = D [OK]
Quick Trick: Create LED with LED(pin_number) [OK]
Common Mistakes:
  • Using keyword arguments not supported
  • Not importing LED before use
  • Using undefined constants like GPIO17

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes