pi-lights/blink.py

19 lines
450 B
Python
Raw Normal View History

2017-01-03 11:17:10 -05:00
#!/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.BOARD)
# set up GPIO output channel
GPIO.setup(7, GPIO.OUT)
# blink GPIO17 50 times
for i in range(0,500):
blink(7)
GPIO.cleanup()