Massive improvement on gpioshell
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bin/
|
||||||
@@ -8,24 +8,52 @@ GPIO.setmode(GPIO.BCM)
|
|||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setwarnings(False)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
gpio = int(input(""))
|
choice = str(input(""))
|
||||||
onoff = int(input(""))
|
|
||||||
|
|
||||||
GPIO.setup(gpio, GPIO.OUT)
|
|
||||||
|
|
||||||
GPIO.output(gpio, onoff)
|
|
||||||
|
|
||||||
|
if choice == "on":
|
||||||
try:
|
try:
|
||||||
main()
|
which=input("")
|
||||||
except KeyboardInterrupt:
|
except ValueError:
|
||||||
GPIO.setmode(GPIO.BCM)
|
which=str(input(""))
|
||||||
GPIO.setup(gpio, GPIO.OUT)
|
|
||||||
GPIO.cleanup()
|
|
||||||
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
if which != "all":
|
||||||
|
pin = int(which)
|
||||||
|
gpio = list()
|
||||||
|
gpio.append(pin)
|
||||||
GPIO.setup(gpio, GPIO.OUT)
|
GPIO.setup(gpio, GPIO.OUT)
|
||||||
|
GPIO.output(gpio, 1)
|
||||||
|
elif which == "all":
|
||||||
|
gpios = [23, 17, 18]
|
||||||
|
for i in gpios:
|
||||||
|
i = int(i)
|
||||||
|
GPIO.setup(i, GPIO.OUT)
|
||||||
|
GPIO.output(i, 1)
|
||||||
|
|
||||||
|
if choice == "off":
|
||||||
|
try:
|
||||||
|
which=input("")
|
||||||
|
print(which)
|
||||||
|
except ValueError:
|
||||||
|
which=str(input(""))
|
||||||
|
print(which)
|
||||||
|
|
||||||
|
if which != "all":
|
||||||
|
pin = int(which)
|
||||||
|
gpio = list()
|
||||||
|
gpio.append(pin)
|
||||||
|
GPIO.setup(gpio, GPIO.OUT)
|
||||||
|
GPIO.output(gpio, 0)
|
||||||
|
elif which == "all":
|
||||||
|
gpios = [23, 17, 18]
|
||||||
|
for i in gpios:
|
||||||
|
i = int(i)
|
||||||
|
GPIO.setup(i, GPIO.OUT)
|
||||||
|
GPIO.output(i, 0)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user