Use HC-SR04 Ultrasonic Sensor to move a motor

Also

Sometimes th distance is switched, like this:

distance = 6
dist2 = 0
distance = 0
dist2 = 6
distance = 0
dist2 = 6
distance = 6
dist2 = 0

Any idea why it does that?

maybe print the values as thought they were signed

didn't work :frowning: