我只想要函数的距离值,如果我打印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 代码