Bird
0
0

What will be the output on the LED connected to pin 12 after running this code snippet?

medium📝 Predict Output Q13 of 15
Raspberry Pi - PWM Output
What will be the output on the LED connected to pin 12 after running this code snippet?
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(12, GPIO.OUT)
pwm = GPIO.PWM(12, 500)
pwm.start(75)
ALED will be at 75% brightness
BLED will blink slowly
CLED will be off
DCode will raise an error
Step-by-Step Solution
Solution:
  1. Step 1: Analyze PWM setup

    Pin 12 is set as output, PWM started at 500 Hz frequency with 75% duty cycle.
  2. Step 2: Understand duty cycle effect on LED

    75% duty cycle means LED is on 75% of the time, so it appears bright but not fully on.
  3. Final Answer:

    LED will be at 75% brightness -> Option A
  4. Quick Check:

    75% duty cycle = 75% brightness [OK]
Quick Trick: Duty cycle % = LED brightness % [OK]
Common Mistakes:
  • Thinking LED is off at start
  • Assuming LED blinks instead of steady brightness
  • Expecting code error without setup

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes