Recall & Review
beginner
What does PWM stand for in PWMLED?
PWM stands for Pulse Width Modulation. It is a technique to control the brightness of an LED by switching it on and off very quickly with varying durations.
Click to reveal answer
beginner
How does PWM control LED brightness?
PWM controls brightness by changing the ratio of ON time to OFF time in each cycle. More ON time means brighter LED; less ON time means dimmer LED.
Click to reveal answer
beginner
In Raspberry Pi, which library is commonly used to control PWMLED?
The gpiozero library is commonly used in Raspberry Pi to control PWMLED easily with simple commands.
Click to reveal answer
beginner
What is the range of brightness values you can set for PWMLED in gpiozero?
Brightness values range from 0 (LED off) to 1 (LED fully on). You can set any decimal value in between for different brightness levels.
Click to reveal answer
beginner
Write a simple Python code snippet to set a PWMLED on GPIO pin 17 to half brightness.
from gpiozero import PWMLED
led = PWMLED(17)
led.value = 0.5 # Sets brightness to 50%Click to reveal answer
What does PWM control in an LED?
✗ Incorrect
PWM controls brightness by adjusting how long the LED is ON versus OFF in each cycle.
Which Python library is used to control PWMLED on Raspberry Pi?
✗ Incorrect
gpiozero is designed for easy control of Raspberry Pi hardware including PWMLED.
What value sets the PWMLED to full brightness?
✗ Incorrect
A value of 1 means the LED is fully on at 100% brightness.
If you want the LED to be off using PWMLED, what value should you set?
✗ Incorrect
Setting the value to 0 turns the LED off completely.
What does a PWM cycle consist of?
✗ Incorrect
A PWM cycle has both ON and OFF times that determine brightness.
Explain how PWM controls the brightness of an LED on a Raspberry Pi.
Think about how fast switching affects how bright the LED looks.
You got /4 concepts.
Write a short Python code example to set an LED connected to GPIO 17 to 75% brightness using PWMLED.
Use the gpiozero PWMLED class and set the value property.
You got /3 concepts.