Last active
August 13, 2017 19:59
-
-
Save rachelwritingcode/f9c703cbd094c384a46c9f41fc890fd5 to your computer and use it in GitHub Desktop.
Python Blink Tutorial
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 the GPIO Library | |
import RPi.GPIO as GPIO | |
import time | |
# blinking function | |
def blink(pin): | |
#Setting the LED to turn on | |
GPIO.output(pin,GPIO.HIGH) | |
time.sleep(1) | |
#Setting the LED to turn off | |
GPIO.output(pin,GPIO.LOW) | |
time.sleep(1) | |
return | |
# to use Raspberry Pi board pin numbers | |
GPIO.setmode(GPIO.BOARD) | |
# set up GPIO output channel | |
GPIO.setup(15, GPIO.OUT) | |
# blink GPIO17 2 times | |
for i in range(0,2): | |
blink(15) | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment