Raspberry PI GPIO Tester
import RPi.GPIO as G | |
from time import sleep | |
import sys | |
if (len(sys.argv) < 1): exit | |
pin = int(sys.argv[-1]) | |
MODE = "BCM" | |
if "BOARD" in sys.argv: | |
MODE = "BOARD" | |
if MODE == "BOARD": | |
G.setmode(G.BOARD) | |
elif MODE == "BCM": | |
G.setmode(G.BCM) | |
G.setup(pin, G.OUT) | |
print "Blinkig on %s pin %d " % (MODE, pin) | |
try: | |
while(True): | |
G.output(pin,0) | |
sleep(0.1) | |
G.output(pin,1) | |
sleep(0.1) | |
except (KeyboardInterrupt, SystemExit): | |
print "Cleaning up" | |
G.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment