Ultrasonic Sensor Starter Robot Problem


#1

Hi all, new to the world of programming and really enjoying it.

So I’m having a problem getting my robot to stop once it gets within 15cm of an object.

Capture

So basically I want it to go forwards when I press up on the remote control and then stop when it is within 15cm.

What am I doing wrong?

Thanks in advance!


#2

It seems your codes are working.
If the Ultrasonic part is not working, you can try to test the ultrasonic part separately.

By the way, two motors are mirror-installed, opposite speed will let it move forward.


#3

But it doesn’t work.
It just keeps on going forwards into the cardboard box until I pick it up and turn it off. The sensor does work as I’ve had it working with different codes I just want to know why this particular code doesn’t work.

What do you mean by the motors are mirror installed? Are you referring to the two values for motors being slightly different?
Thanks


#4

I also tested with a little different codes.
Mirror installed, the motors move in opposite direction using same speed


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.