Help with IR obstacle avoiding robot with two DC motors, a servo, L298N shield

Hello All.
First post on the forum, after reading the forum guidelines, searching google and arduino cc, and also letsmakerobots web for help on my issue, I'm still a bit lost.

Maybe I'm a bit too new to try building an obstacle avoiding robot, but I'm trying my best. I believe I have all things I need, that is: a robot structure with two DC motors and wheels attached, and a free spinning wheel on the front, a small servo, Arduino UNO rev3, a simple motor shield that can drive two DC motors using an L298N, wires, battery packs etc. I'm planning on using IR to detect obstacles, so far I got a "KeyesIR" simple circuit. (Im looking for a nicer "sharp" one, and maybe an Ultrasound one too, but I dont have them yet).

-KeyesIR sensor Picture:

-Motor shield with L298N Picture:

having said that, I managed to control the servo alone yesterday with some code I found that creates a sweep motion.

I also managed to connect the DC motors to the L288N, and got the spinning back and forth, and slower and faster with some other code.

But as I'm a total newbie I can only understand a bit of the code I read, but not create new one. Or join pieces of code together, and tweak them.

I'm sure there must be some code to operate a robot with the same pieces I'm using (or very similar), but after trying for quite some time I only find code for similar robots that use Ultra sounds, or three servos, or different motor shields instead, or even PICaxe, etc.

So, anyone knows where to get some working code I can use to get this working? I know I'll have to tweak the spinning times for my particular robot, or the detection distance, etc. and I believe I could do that, but building the whole code from parts is a bit too hard for me now.

Thanks in advance, I hope I provided enough info :slight_smile: