I need help with code

Hello, I’m trying to write a code to make a robotic car autonomous, using an ultrasonic sensor.I want the sensor to send data to the motor, such that when it detects an obstacle with a certain range, it should move away, from the obstacle. Thank you in advance.

Please read the post "How to use this forum" and follow the directions. Post your code, using code tags and a clear, hand drawn wiring diagram.

Hi Wvri,
We need more details as JR says, we're not mind readers, do you have any code? can you code. I have built a few robots, take a look here... www.melsaunders.co.uk I have coding, wiring, etc...

The U/S sends data to the Arduino, that then controls the motors, etc.

Oh!! dear I have just noticed you are using one of these crazy motor driver boards, you have to use their library which is why I never use it!! it uses a logic chip to sent data serially to the L293 drivers, also I found by default it uses motor-outputs 1/-3, NOT 1 & 2 as expected? all very confusing..... This is your worst problem, plus the L293 drivers lose power in the output transistors, 2-3v, get a board using FET outputs, some super little modules out there... look for the DRV series.

Hope it helps.

Mel.

Please see this instruction Arduino Robot With Ir Detector : 3 Steps - Instructables
Robot can detecting and going around the barrier.

Hi Wvri,
Istructables are very unreliable and contain many mistakes!! In your first post you say your using a U/S sensor?

So why not tell us just what your doing and how it is all wired up, show us a schematic or a good pencil drawing of it or some good pictures AND your code... It's the only way we can help you.

Regards

Mel.