Finished LED test program (The extra setups at the top are needed to clear the gpio pin)
This commit is contained in:
@@ -4,18 +4,24 @@ import RPi.GPIO as GPIO
|
|||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
GPIO.cleanup()
|
gpio = int(input("What GPIO port would you like to test? "))
|
||||||
GPIO.setmode(GPIO.BCM)
|
|
||||||
GPIO.setup(23, GPIO.OUT)
|
|
||||||
|
|
||||||
GPIO.output(23, 0)
|
GPIO.setwarnings(False)
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setup(gpio, GPIO.OUT)
|
||||||
|
GPIO.cleanup()
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setup(gpio, GPIO.OUT)
|
||||||
|
|
||||||
|
GPIO.output(gpio, 0)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
GPIO.output(23, 1)
|
GPIO.output(gpio, 1)
|
||||||
print("on")
|
print("on")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
GPIO.output(23, 0)
|
GPIO.output(gpio, 0)
|
||||||
print("off")
|
print("off")
|
||||||
|
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
|
|||||||
Reference in New Issue
Block a user