Complete the code to import the GPIO library for Raspberry Pi.
import [1]
RPi.GPIO is the standard library to control GPIO pins on Raspberry Pi.
Complete the code to set GPIO pin 17 as an output.
GPIO.setup([1], GPIO.OUT)Pin 17 is commonly used for relay control and must be set as output.
Fix the error in the code to turn the relay ON by setting the pin LOW.
GPIO.output(17, [1])
For many relay modules, setting the pin LOW activates the relay (turns it ON).
Complete the code to create a dictionary mapping relay names to their GPIO pins.
relays = {[1]: pin for {{BLANK_3}} in ['relay1', 'relay2', 'relay3']}The dictionary starts with '{' and maps relay names to pin numbers stored in 'pin'.
Fill all three blanks to turn all relays OFF by setting their pins HIGH.
for pin in relays.values(): GPIO.output([1], [2]) print([3])
We loop over each pin, set it HIGH to turn relay OFF, then print a confirmation message.
