Fading RGB LED with PWM Controll

The circuit is very simple. The RGB LED is hooked up to the PWM outputs on PORTB1 , PORTB2 and PORTB3 of the ATMega8. There is also a resistor between the LED and the ATmega8 to limit the current to 20mA. There is also a link to the datasheet of the RGB LED that is used in this project.

The code for the fading LED is written in assembler with the AVR Studio 4. In this example the LEDs will fade in and out one by one. The PWM timers of the ATMega8 are used to let the LED’s fade in and out. To use the PWM timers you first need to initialize the timers at the begin of the program code. The speed of the fading in and out can be changed with changing the clock speed of the ATM8.You can copy and paste the textfile into the AVR Studio 4.

Fading RGB LED with PWM Controll: [Link]