import RPi.GPIO as GPIO # Import library for GPIO (pin) access GPIO.setmode(GPIO.BOARD) # Specify that we use the BOARD numbers (pin numbers 1-40 on the connector) GPIO.setwarnings(False) # Disable the warning "This channel is already in use" # ******** PIN CONFIGURATION ************************************* GPIO.setup(22, GPIO.OUT) # Configure pin 22 as an output (OUT) # **************************************************************** GPIO.output(22, 0) # Turn off the LED when the program starts # It could be on if a previous program left it on while True: x = input("Enter on or off: ") if x == 'on': GPIO.output(22, 1) elif x == 'off': GPIO.output(22, 0)