Odd readings with 2 ultrasonic sensors


#1

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?

thanks

peter


#2

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


#3

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.