I just want the distance value from the function, if i print the working_odo it drives me in the while loop. I just want distance
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
This is a raspberry gpio code for encoder
I am not sure that got you correctly, maybe: