I'm new to arduino and the programming part, but due to my interest in robotics i have now built an obstacle sensing robot using an arduino with an ATMEGA128 chip in it, i have used an ir sensor, and a motor driver with L293DNE, and my robot has 2 stepper motors. i have no servo for my robot

i have connected my arduino to my computer and i've tried many basic programs such as blink and fade and it all works perfectly.

now after connecting all the parts, i'm in need of a program to run my robot such that when my robot senses an obstacle it should stop moving and then turn and take another route and continue the same way.

since this is my first venture into arduino and robots, i thought i'll start from the basic

please can some one help me, by building a code for me so as to run the robot. i would be really very thankful and grateful if someone could help me by doing the needful