im really sorry but i didnt understand any of that i think i might just look up a tutorial on c programming.thanks for trying to help me anyway

Heh - OK. Feel free to bug me about any step that you need to know more about.

Yes, a C tutorial would help you a lot.

Your code:

#define left_sensor PD0

tells the C compiler that anywhere you have "left_sensor" it should replace it with "PDO".

My code:

#define left_sensor (PIND & 0x01)

replaces "left_sensor" with reading the input register in the mega8 called PIND and masking out all but the lowest but with a "logical and". So in that way you are only looking at the lowest bit in port D.

Well, sorry. I apologize for going too fast. Please feel free to lean on me a bit for help.

Have you looked at the Arduino stuff? The Arduino uses the mega168 which is close to the mega 8. "Arduino" is more than just the hardware - it is also the free development environment. A LOT of people use the Arduino as a starting spot for learning hardware and software.

If you look at the Arduino tutorials, that might help a little bit. The language is basically C and a sample bit of that code studied might help you a bit. If you download the Arduino IDE, you will see that it supports the mega 8.

Arduino is basically C but at a higher level (more basic). The heart of Arduino is C, its just that the thing you actually code into the Arduino software is simpler, and the Arduino software translates that into normal C.