Recall & Review
beginner
What is the basic sequence of colors in a traffic light simulation?
The basic sequence is: Green (go), Yellow (prepare to stop), Red (stop). This cycle repeats continuously.
Click to reveal answer
beginner
Which Raspberry Pi pins are commonly used to connect LEDs for a traffic light simulation?
GPIO pins on the Raspberry Pi are used to connect LEDs. For example, GPIO 17 for Red, GPIO 27 for Yellow, and GPIO 22 for Green LEDs.
Click to reveal answer
beginner
Why do we use delays (like time.sleep) in a traffic light simulation program?
Delays pause the program so each light stays on for a visible amount of time, simulating real traffic light timing.
Click to reveal answer
intermediate
How can you safely clean up GPIO settings after running a traffic light program on Raspberry Pi?
Use GPIO.cleanup() at the end of the program to reset the GPIO pins and avoid warnings or errors on next run.
Click to reveal answer
beginner
What Python library is commonly used to control Raspberry Pi GPIO pins in a traffic light simulation?
The RPi.GPIO library is commonly used to control GPIO pins for turning LEDs on and off.
Click to reveal answer
Which color light should turn on first in a traffic light simulation?
✗ Incorrect
The red light signals 'stop' and usually comes first in the traffic light cycle.
What does GPIO.cleanup() do in a Raspberry Pi traffic light program?
✗ Incorrect
GPIO.cleanup() resets the GPIO pins so they are ready for the next program run.
Which Python module is typically imported to control Raspberry Pi GPIO pins?
✗ Incorrect
RPi.GPIO is the module used to control GPIO pins on Raspberry Pi.
Why do we use time.sleep() in a traffic light simulation?
✗ Incorrect
time.sleep() pauses the program so each light stays on long enough to see.
Which GPIO pin number is commonly used for the red LED in examples?
✗ Incorrect
GPIO 17 is often used for the red LED in Raspberry Pi traffic light examples.
Explain how to set up a simple traffic light simulation using Raspberry Pi GPIO pins and Python.
Think about hardware setup, controlling pins, timing, and cleanup.
You got /6 concepts.
Describe the role of each color in a traffic light simulation and how you would program their timing.
Focus on the meaning of colors and timing control.
You got /4 concepts.