Complete the code to set a GPIO pin as input with a pull-up resistor.
GPIO.setup(17, GPIO.IN, pull_up_down=[1])
Using GPIO.PUD_UP enables the pull-up resistor on the input pin.
Complete the code to read the state of a GPIO pin configured with a pull-down resistor.
state = GPIO.input([1])
The pin number (e.g., 18) is needed to read its state with GPIO.input().
Fix the error in the code to correctly set a GPIO pin with a pull-down resistor.
GPIO.setup(22, [1], pull_up_down=GPIO.PUD_DOWN)
The pin must be set as input (GPIO.IN) to use pull-down resistors.
Fill both blanks to create a dictionary mapping pin numbers to their pull resistor types.
pin_resistors = {17: [1], 18: [2]Pin 17 uses a pull-up resistor, and pin 18 uses a pull-down resistor.
Fill all three blanks to set up pin 23 as input with pull-up resistor and read its state.
GPIO.setup([1], [2], pull_up_down=[3]) state = GPIO.input(23)
Pin 23 is set as input with a pull-up resistor before reading its state.