Files
pibox/testprograms/gpioshell
LazyAssassin445 24c87c1b3f Updated gpioshell
2017-03-18 22:10:17 +00:00

32 lines
486 B
Python
Executable File

#!/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()