Complete the code to import the GPIO library for Raspberry Pi.
import [1] as GPIO
The RPi.GPIO library is used to control the GPIO pins on a Raspberry Pi for hardware projects like traffic lights.
Complete the code to set the GPIO mode to BCM numbering.
GPIO.setmode([1])Setting GPIO mode to GPIO.BCM means we use the Broadcom chip's pin numbering.
Fix the error in setting up pin 17 as an output.
GPIO.setup([1], GPIO.OUT)Pin 17 is the correct GPIO pin number to set as output for the traffic light LED.
Fill both blanks to turn on the green LED connected to pin 22.
GPIO.output([1], [2])
Pin 22 controls the green LED. Setting output to GPIO.HIGH turns it on.
Fill all three blanks to create a dictionary mapping LED colors to their GPIO pins.
led_pins = { [1]: [2], [3]: 22 }The dictionary maps 'red' to pin 17 and 'green' to pin 22 for the traffic lights.
