Recall & Review
beginner
What is the purpose of the LED class in Raspberry Pi programming?The LED class is used to control an LED light connected to the Raspberry Pi's GPIO pins. It allows turning the LED on, off, and blinking it through simple methods.Click to reveal answer
beginner
Name three common methods of the LED class and their functions.- on(): Turns the LED light on.
- off(): Turns the LED light off.
- blink(): Makes the LED blink on and off repeatedly.
Click to reveal answer
beginner
How do you create an LED object for GPIO pin 17 in Python on Raspberry Pi?
You import the LED class and create an instance like this:<br><pre>from gpiozero import LED
led = LED(17)</pre>Click to reveal answer
intermediate
What happens if you call led.blink() without any arguments?
The LED will blink on and off repeatedly with default timing: 1 second on, 1 second off, until stopped.
Click to reveal answer
beginner
How can you stop an LED from blinking once it has started?
You call the
led.off() method to turn off the LED and stop blinking.Click to reveal answer
Which method turns the LED light on?
✗ Incorrect
The on() method turns the LED on.
What argument do you pass to the LED class when creating an LED object?
✗ Incorrect
You pass the GPIO pin number where the LED is connected.
What does the blink() method do by default?
✗ Incorrect
blink() makes the LED blink on and off repeatedly.
How do you stop an LED from blinking?
✗ Incorrect
Calling led.off() turns off the LED and stops blinking.
Which library provides the LED class for Raspberry Pi GPIO control?
✗ Incorrect
The gpiozero library provides the LED class.
Explain how to control an LED connected to a Raspberry Pi using the LED class.
Think about how you tell the Raspberry Pi which pin the LED is on and how you turn it on or off.
You got /3 concepts.
Describe what happens when you call the blink() method on an LED object without arguments.
Consider the default behavior of blinking without extra instructions.
You got /3 concepts.