diff --git a/gpio.py b/gpio.py new file mode 100644 index 0000000..7600065 --- /dev/null +++ b/gpio.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# -*- coding:utf-8 -*- + +import RPi.GPIO as GPIO +import time + +def main(): + LED = 26 + + GPIO.setmode(GPIO.BCM) + GPIO.setup(LED, GPIO.OUT) + + try: + while True: + GPIO.output(LED, GPIO.HIGH) + time.sleep(1) + GPIO.output(LED, GPIO.LOW) + time.sleep(1) + except: + print("except") + GPIO.output(LED, GPIO.HIGH) + GPIO.cleanup() + + +if __name__ == '__main__': + main() diff --git a/led.py b/led.py new file mode 100644 index 0000000..f0df155 --- /dev/null +++ b/led.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# -*- coding:utf-8 -*- + +import RPi.GPIO as GPIO +import time + +def main(): + LED = 26 + + GPIO.setmode(GPIO.BCM) + GPIO.setup(LED,GPIO.OUT) + + try: + while True: + GPIO.output(LED,GPIO.HIGH) + time.sleep(1) + GPIO.output(LED,GPIO.LOW) + time.sleep(1) + except: + print("except") + GPIO.output(LED,GPIO.HIGH) + GPIO.cleanup() + +if __name__=='__main__': + main() +