Complete the code to import the GPIO library.
import [1]
The Raspberry Pi GPIO library is imported as RPi.GPIO as GPIO to control the pins easily.
Complete the code to set the GPIO mode to BCM.
GPIO.setmode([1])Setting GPIO mode to GPIO.BCM means you use the Broadcom chip pin numbers.
Fix the error in the code to clean up GPIO on program exit.
try: # Your code here pass finally: [1]()
The GPIO.cleanup() function resets all GPIO pins used by the program, preventing warnings on next run.
Fill both blanks to set up a GPIO pin 18 as output and then clean up on exit.
GPIO.setup([1], [2]) try: # Use the pin pass finally: GPIO.cleanup()
Pin 18 is set as an output pin using GPIO.OUT. Cleanup is called after usage.
Fill all three blanks to write a high signal to pin 23, then clean up GPIO on exit.
GPIO.setup([1], [2]) GPIO.output([3], GPIO.HIGH) try: pass finally: GPIO.cleanup()
Pin 23 is set as output, then set to HIGH signal. Cleanup resets pins on exit.
