// Define pins for RGB LED
const int redPin = 9;
const int greenPin = 10;
const int bluePin = 11;
void setup() {
// Initialize pins as output
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
// Set RGB LED colors
setColor(255, 0, 0); // Red
delay(1000); // Wait for 1 second
setColor(0, 255, 0); // Green
delay(1000); // Wait for 1 second
setColor(0, 0, 255); // Blue
delay(1000); // Wait for 1 second
}
// Function to set RGB LED color
void setColor(int red, int green, int blue)
{
analogWrite(redPin, red); // Set red intensity
analogWrite(greenPin, green); // Set green intensity
analogWrite(bluePin, blue); // Set blue intensity
}