Created
October 4, 2014 17:04
-
-
Save anoochit/ee04d87e09c2f3db6349 to your computer and use it in GitHub Desktop.
raspberry pi gpio blink example
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
#!/usr/bin/python | |
import RPi.GPIO as GPIO | |
import time | |
# blinking function | |
def blink(pin): | |
GPIO.output(pin,GPIO.HIGH) | |
time.sleep(1) | |
GPIO.output(pin,GPIO.LOW) | |
time.sleep(1) | |
return | |
# to use Raspberry Pi board pin numbers | |
GPIO.setmode(GPIO.BCM) | |
# set up GPIO output channel | |
GPIO.setwarnings(False) | |
GPIO.setup(17,GPIO.OUT) | |
# blink GPIO17 | |
while True: | |
blink(17) | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment