Last active
August 29, 2015 14:10
-
-
Save HeinrichHartmann/4affce9f06368d946e9d to your computer and use it in GitHub Desktop.
Raspberry PI GPIO Tester
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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