// Pin assignments for the RGB LED
int redPin = 11;
int greenPin = 10;
int bluePin = 9;
void setup() {
// Set the RGB LED pins as output
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
// Set color to red
setColor(255, 0, 0); // Red
delay(1000); // Wait 1 second
// Set color to green
setColor(0, 255, 0); // Green
delay(1000); // Wait 1 second
// Set color to blue
setColor(0, 0, 255); // Blue
delay(1000); // Wait 1 second
// Set color to white
setColor(255, 255, 255); // White (mix of all colors)
delay(1000); // Wait 1 second
}
// Function to set the RGB color
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(redPin, redValue);
analogWrite(greenPin, greenValue);
analogWrite(bluePin, blueValue);
}