1
2 # -*- coding: utf-8 -*-
3 """
4 Created on Sun May 27 20:06:12 2018
5
6 @author: Long Chunxu
7 """
8
9
10 import RPi.GPIO as GPIO
11 import time
12
13 GPIO.setwarnings(False)
14 GPIO.setmode(GPIO.BCM)
15 GPIO.setup(18,GPIO.OUT)
16
17 try:
18 while 1:
19 GPIO.output(18,GPIO.HIGH)
20 time.sleep(0.5)
21 GPIO.output(18,GPIO.LOW)
22 time.sleep(0.5)
23 finally:
24 print("clean up all GPIO..." )
25 GPIO.cleanup()
~
~代码很简单~~当做纪念~~参考吧!
2 # -*- coding: utf-8 -*-
3 """
4 Created on Sun May 27 20:06:12 2018
5
6 @author: Long Chunxu
7 """
8
9
10 import RPi.GPIO as GPIO
11 import time
12
13 GPIO.setwarnings(False)
14 GPIO.setmode(GPIO.BCM)
15 GPIO.setup(18,GPIO.OUT)
16
17 try:
18 while 1:
19 GPIO.output(18,GPIO.HIGH)
20 time.sleep(0.5)
21 GPIO.output(18,GPIO.LOW)
22 time.sleep(0.5)
23 finally:
24 print("clean up all GPIO..." )
25 GPIO.cleanup()
~
~代码很简单~~当做纪念~~参考吧!