接着我又继续测试了红外传感器
import time
import RPi.GPIO as GPIO
led = 3
try:
GPIO.setmode(GPIO.BOARD)
GPIO.setup(led,GPIO.OUT)
GPIO.setup(12,GPIO.IN)
while True:
in_value= GPIO.input(12)
if in_value == 1:
GPIO.output(led,True)
time.sleep(1)
GPIO.output(led,False)
else:
print('close: ', in_value)
except:
pass
GPIO.cleanup()
‘
转载于:https://www.cnblogs.com/saveme/p/10066076.html
相关资源:DirectX修复工具V4.0增强版