Hello, I am wondering g\how to use the ultrasonic sensor so that when it senses something is 4 cm (or whatever unit) away it will stop.
Compare the distance read from the sensor in cm against the number 4 in a control structure appropriate to your use case, with the motors stopping being contingent on the result. You will want to use an inequality comparison operator as the sensor is unlikely to ever read any given exact reading.
Any advice more specific than that would require knowing what you’re using to program, how far you’ve gotten already, what your program looks like, whether there was anything unfamiliar to you in my previous advice, etc.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.