Blink LED script using python

0
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time

LedPin = 11

GPIO.setmode(GPIO.BOARD)
GPIO.setup(LedPin, GPIO.OUT)
GPIO.output(LedPin, GPIO.HIGH)

try:
	while True:
		print '... led on'
		GPIO.output(LedPin, GPIO.LOW)
		time.sleep(5)
		print 'led off...'
		GPIO.output(LedPin, GPIO.HIGH)
		time.sleep(5)
except KeyboardInterrupt:
	GPIO.output(LedPin, GPIO.HIGH)
	GPIO.cleanup()
Share.

About Author

Christian Unnerstall

Christian Unnerstall, founder of devshooin.com, enjoys designing and building things that look nice and work well, whether it's websites or services within the interwebs. Have questions - feel free to reach out to him. Enjoy

Leave a Reply