Beautiful Lighting Idea

RGB LED With Arduino



Watch Full Video

Components Used

• Arduino Board (Uno/Nano/Mega) - 1
• RGB led - 1
• 220 Ohm Resistor - 3


Download Code File



void setup() 
pinMode(2, OUTPUT);
pinMode(3, OUTPUT); 
pinMode(4, OUTPUT); 
void loop() 
{
analogWrite(2, 255); 
analogWrite(3, 0); 
analogWrite(4, 0); 
delay(1000); // Wait for 1000 millisecond(s) 

analogWrite(2, 0); 
analogWrite(3, 255); 
analogWrite(4, 0); 
delay(1000); // Wait for 1000 millisecond(s) 
    
analogWrite(2, 0); 
analogWrite(3, 0); 
analogWrite(4, 255); 
delay(1000); // Wait for 1000 millisecond(s) 
 
analogWrite(2, 255); 
analogWrite(3, 255); 
analogWrite(4, 0); 
delay(1000); // Wait for 1000 millisecond(s) 
    
    analogWrite(2, 255); 
analogWrite(3, 0); 
analogWrite(4, 255); 
delay(1000); // Wait for 1000 millisecond(s) 
    
    analogWrite(2, 0); 
analogWrite(3, 255); 
analogWrite(4, 255); 
delay(1000); // Wait for 1000 millisecond(s) 
 }



Comments