Code help for arduino uno car

Hello i am a complete beginner to the world of Arduino and coding.

I started a new car project using Arduino uno and built it from scratch. Soldering and mounting part was pretty easy, i know i did a couple of things sub-optimally but otherwise the car is functional and ready to go.

The problem is that i can't seem to find functional code for my setup.

The setup uses A and B for each side of wheels and a HC-SRO4 sensor.



Except for pictures, this is a duplicate of http://forum.arduino.cc/index.php?topic=372408.0

Again, please provided a schematc.

I apologize for the double post, that wasn't done intentionally as an error popped up before when i tried to post with pictures in attachments and i thought it wouldn't go through.

As for the schematics i'm afraid im unable to provide one. But it is a very basic car. Wheels run to A and B slots. Power runs to a switch and the arduino itself. And the sensor runs to 5V and GND along with Digital pins 3 and 2. And that is pretty much it.

The other post seems to be gone. If I remember correctly you mentioned something like HC 04. google arduino hc 04

I don't have any idea what A and B are.

Ahh my apologies. The thing mounted on Arduino is a Arduino Motor shield which is where the wiring on wheels run to.

Found with google: http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/. Not checked for correctness; you can compare it with some PWM examples.

I need the car to recognize when something is infront of it with the sensor and then turn around or something like that but im not sure at all how to do that. All the code i've seen online points to those 2 wheeled robots.

Eredir:
I need the car to recognize when something is infront of it with the sensor and then turn around or something like that but im not sure at all how to do that. All the code i've seen online points to those 2 wheeled robots.

It's done with a thing called "programming". :slight_smile:

Begin by defining the problem. Picture the situation in your mind and walk through the steps. Write them down. Take each step separately, and write code for it.