【发布时间】:2021-01-06 02:53:51
【问题描述】:
我只想要函数的距离值,如果我打印 working_odo 它会驱使我进入 while 循环。我只想要距离
def working_odo():
last_state=IO.input(15)
state_count=0
while 1:
current_state=IO.input(15)
if(current_state!=last_state):
state_count+=1
#print(state_count)
last_state=current_state
distance = 0.001*state_count
这是一个用于编码器的树莓gpio代码
【问题讨论】:
标签: python-3.x raspberry-pi4 pigpio