红外避障传感器输入信号,条件控制输出信号,为什么没反应?
-
import time from pyb import Servo from pyb import Pin s1 = Servo(1) s2 = Servo(2) p_in00 = Pin("P6", Pin.IN)#设置p0输入 p_in00.value() while(True): if p_in00.value()==1: for i in range(1000): s1.pulse_width(600 + i) time.sleep(8) for i in range(500): s1.pulse_width(500 - i) #s2.pulse_width(1000 + i) time.sleep(10)
-
你应该先试一下
import time p_in00 = Pin("P6", Pin.IN)#设置p0输入 p_in00.value() while(True): if p_in00.value()==1: print(p_in00.value()) time.sleep(100)
看一下有没有打印数字