#!/usr/bin/python3 import RPi.GPIO as GPIO import time import sys GPIO.setmode(GPIO.BCM) GPIO.cleanup() GPIO.setmode(GPIO.BCM) def main(): gpio = int(input("")) onoff = int(input("")) GPIO.setup(gpio, GPIO.OUT) GPIO.output(gpio, onoff) try: main() except KeyboardInterrupt: GPIO.setmode(GPIO.BCM) GPIO.setup(gpio, GPIO.OUT) GPIO.cleanup() GPIO.setmode(GPIO.BCM) GPIO.setup(gpio, GPIO.OUT) main()