In this tutorial, we will create a sketch in which the RGB LED emits only the green light that turns on and off gradually. In the second example, you will see that red, green and blue lights also turn on and off gradually.

This project is suitable for school students and beginners.

For this experiment, you will need 1 RGB LED and three 220 Ohm resistors.

Name Quantity Component
D1 1 LED RGB
U1 1 Arduino Uno R3
R1
R2
R3
3 220 Ω Resistor

Experiment 1: Only Green light turns on and off gradually


Arduino Sketch 1:

Experiment 2: All lights turn on and off gradually

Arduino Sketch 2: