title: Software PWM on AVR using delay
body: <p>I am trying to accomplish a simple PWM generation using delays on an AVR ATMega16</p>
  
  <p>What i am trying to do is simply fade a led from 100% to 0% duty cycle, and later i will expand it to control two colors of a bicolor led to have a nice effect.</p>
  
  <p>I have done this in mikroC with PICs before, but somehow it's not as easy in avr-gcc, or maybe i am missing something.</p>
  
  <p>My problem here is that i want the led to fade completely in 3 seconds, but i feel its fading faster. I also think that it's spending more time on high duty cycles than on low ones. I mean that i see the led bright for a bit, then it fades, but when it becomes dim it moves to different duty cycles very fast or so i think..</p>
  
  <p>Any ideas you might have on what i am missing ?</p>
  
  <p>Code is available here : <a href="http://ideone.com/lUP5f" rel="nofollow">http://ideone.com/lUP5f</a></p>
  
  <p>Thanks</p>