Obstacle avoiding robot

hi guys

i was planning to make an obstacle avoiding robot using sharp ir sensor and the arduino uno i also have 2 continuous rotating servo motors ...... however i wanted to make the robot without an motor shield therefore i added an 6v external battery supply for the servos .... so if any one could help me with code please

thanks

ps.... i connected the servos to digital input 9 and to left right respectively and the ir sensor to either analog 3 or to digital 3

thanks

ali_khan: ps.... i connected the servos to digital input 9 and to left right respectively and the ir sensor to either analog 3 or to digital 3

That makes no sense. You should not have both motors connected to Pin 9 and the pins you use to control the servos should be OUTPUT, not INPUT. Pin 3 and Pin A3 are two different pins. If you are using the analog output of the distance sensor you use an analog input pin like A3. Use the Servo library to control the motors. There are LOTS of examples of using continuous-rotation servos. Basically leftServo.write(0) means max speed one way and leftServo.write(180) means max speed the other way. leftServo.write(90) should mean STOP if everything is tuned correctly. You may have to experiment to find the STOP value for each of your servos.

If you sense an object, turn, else continue forward.

hi sorry bou that imeant that i connected the servos to digital rail 9 and 10 and the sensor to input 3\

but how do i write a code for the robot thanks

ali_khan: but how do i write a code for the robot thanks

I told you: "If you sense an object, turn, else continue forward."

but how do i write a code for the robot thanks

Have you even looked at the examples in the IDE ?

UKHeliBob: Have you even looked at the examples in the IDE ?

i did take a look at the example however but i am new to programming so if anyone could send me the sketch i would be grateful

ali_khan: i did take a look at the example however but i am new to programming so if anyone could send me the sketch i would be grateful

This section of the forum is to provide help to people with programming problems, not to write whole programs for them.

There is a "Gigs and Collaborations" section of the forum if you want a complete program written to your specification but it might cost you. If you want the thread moved there then use the "report to moderator" link below one of your posts and ask them to move it. Otherwise, have a go yourself and we will provide help for any problems encountered.

thanks