0
0
Raspberry Piprogramming~5 mins

Traffic light simulation in Raspberry Pi - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AYellow
BGreen
CBlue
DRed
What does GPIO.cleanup() do in a Raspberry Pi traffic light program?
ATurns all LEDs on
BResets GPIO pins to default state
CStarts the traffic light sequence
DIncreases LED brightness
Which Python module is typically imported to control Raspberry Pi GPIO pins?
ARPi.GPIO
Btime
Cos
Dsys
Why do we use time.sleep() in a traffic light simulation?
ATo turn off all LEDs
BTo speed up the light changes
CTo pause so lights stay on visibly
DTo reset the program
Which GPIO pin number is commonly used for the red LED in examples?
AGPIO 17
BGPIO 22
CGPIO 27
DGPIO 5
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.