A few weeks ago, I wanted to program an ATMega8 using C, but I had absolutely no experience in programming, in any language. So I went online and did a few (okay, I did LOADS) of beginner tutorials in C, and I think I've grasped the basics now. The program I want to write is a fairly simple one; it involves taking in just one sensor input and using that to output a signal for a few seconds. I don't want to have anybody else program it for me, so my question is: Are there any microcontroller-programming tutorials out there? I've googled for hours but can't find any. Or, could one of you point me to an easy-to-follow code with comments, which could help a beginner like me understand it? I can't seem to understand how to program which port the IC should take in input from, or give output to.
Any and all help will be greatly appreciated.