You should probably be looking @ using PWM with the ATMEGA timer peripherals for this kind of stuff -