Updated gpioshell
This commit is contained in:
@@ -4,19 +4,28 @@ import RPi.GPIO as GPIO
|
|||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.cleanup()
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
gpio = int(input(""))
|
gpio = int(input(""))
|
||||||
onoff = int(input(""))
|
onoff = int(input(""))
|
||||||
|
|
||||||
GPIO.setwarnings(False)
|
GPIO.setup(gpio, GPIO.OUT)
|
||||||
GPIO.setmode(GPIO.BCM)
|
|
||||||
GPIO.setup(gpio, GPIO.OUT)
|
|
||||||
GPIO.cleanup()
|
|
||||||
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.output(gpio, onoff)
|
||||||
GPIO.setup(gpio, GPIO.OUT)
|
|
||||||
|
|
||||||
GPIO.output(gpio, onoff)
|
try:
|
||||||
main()
|
main()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setup(gpio, GPIO.OUT)
|
||||||
|
GPIO.cleanup()
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setup(gpio, GPIO.OUT)
|
||||||
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user