Odd readings with 2 ultrasonic sensors

My son was trying to write a python script to build an autonomous racing robot with 2 ultrasonic sensors. When we print out the readings, the values are erratic and aren’t accurate. His python script doesn’t sleep between readings, is it necessary to put a sleep between sensor readings and what is the minimum?

Has anyone tried BrickPi with 2 or 3 ultrasonic sensors?



fired it out. adding a time.sleep(.01) resolved the odd sensor readings. Looks like that was the critical piece that was missing.

Woolfel, thanks for answering your own question. :slight_smile:

Indeed, for better performance there should be a wait in there somewhere. A 0.1 second wait is probably a prudent choice.