I am trying to build a robocar that has an ultrasonic sensor in front of it. How do I program it to stop at the distance I input through serial monitor? Thank you in advanced
I am using Arduino Uno
You look at the example code that comes with the ultrasonic library to see how it calculates distance and then adapt that code to fit your needs.
What have you tried?
Have you written a short program to measure the distance with the ultrasonic sensor and show the value on the Serial Monitor?
If not, that should be your first step.
...R
The second step would be to read a value from the serial port, like 27. That's not as simple as it might appear, but Robin2 has a great tutorial, Serial Input Basics - Updated, that you should find, read, understand, and embrace. I'm surprised he didn't mention it.
This the link to Serial Input Basics - simple reliable ways to receive data.
...R