Bird
0
0

What will be the brightness level of the LED after running this code?

medium📝 Predict Output Q4 of 15
Raspberry Pi - gpiozero Library
What will be the brightness level of the LED after running this code?
from gpiozero import PWMLED
led = PWMLED(12)
led.value = 0.5
print(led.value)
A0.5
B1.0
C0
DError: attribute 'value' not found
Step-by-Step Solution
Solution:
  1. Step 1: Understand setting PWMLED brightness

    Assigning 0.5 to led.value sets brightness to 50%.
  2. Step 2: Check printed output

    Printing led.value returns the current brightness, which is 0.5.
  3. Final Answer:

    0.5 -> Option A
  4. Quick Check:

    Brightness set and printed = 0.5 [OK]
Quick Trick: led.value holds current brightness as float [OK]
Common Mistakes:
  • Expecting print to show 1.0 by default
  • Confusing led.value with on/off state
  • Assuming attribute error occurs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes