From 88b11438deab07a95261c7db9ca4d25d75c4a20d Mon Sep 17 00:00:00 2001 From: mandlm Date: Wed, 23 Dec 2015 21:09:52 +0100 Subject: [PATCH] blinking led on gpio port 4 --- led.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 led.py diff --git a/led.py b/led.py new file mode 100755 index 0000000..5aa4052 --- /dev/null +++ b/led.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +from time import sleep + +import RPi.GPIO as GPIO + +print 'blah' + +try: + GPIO.setmode(GPIO.BCM) + GPIO.setup(4, GPIO.OUT) + + while True: + GPIO.output(4, 1) + sleep(1) + GPIO.output(4, 0) + sleep(1) +except KeyboardInterrupt: + GPIO.output(4, 0) +finally: + GPIO.cleanup() + +print 'end'