Raspberry Pi - LED and Button ProjectsWhich 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)Check Answer
Step-by-Step SolutionSolution:Step 1: Identify the correct function to set output valueGPIO.output(pin, value) sets the voltage level on the pin, turning the LED on or off.Step 2: Confirm the correct parametersPin 17 is the GPIO pin, and GPIO.HIGH sets the pin to high voltage (turns LED on).Final Answer:GPIO.output(17, GPIO.HIGH) -> Option BQuick 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 valueConfusing GPIO.setup with outputUsing GPIO.read which does not exist
Master "LED and Button Projects" in Raspberry Pi9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Raspberry Pi Quizzes GPIO Basics with Python - GPIO pin numbering (BCM vs BOARD) - Quiz 2easy GPIO Basics with Python - Digital output (GPIO.output) - Quiz 11easy GPIO Basics with Python - GPIO cleanup on exit - Quiz 10hard LED and Button Projects - Button with interrupt (GPIO.add_event_detect) - Quiz 14medium LED and Button Projects - Multiple LED patterns - Quiz 7medium PWM Output - LED brightness control - Quiz 9hard PWM Output - Servo motor control with PWM - Quiz 14medium Raspberry Pi Platform - Remote access with SSH - Quiz 6medium gpiozero Library - Button class with callbacks - Quiz 8hard gpiozero Library - Buzzer and TonalBuzzer - Quiz 11easy