28 lines
440 B
Python
Executable File
28 lines
440 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import RPi.GPIO as GPIO
|
|
import time
|
|
import sys
|
|
|
|
gpio = int(input("What GPIO port would you like to test? "))
|
|
|
|
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:
|
|
time.sleep(5)
|
|
GPIO.output(gpio, 1)
|
|
print("on")
|
|
time.sleep(5)
|
|
GPIO.output(gpio, 0)
|
|
print("off")
|
|
|
|
GPIO.cleanup()
|