// Define RGB LED pins
const int redPin = 27;
const int greenPin = 26;
const int bluePin = 25;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
setColor(255, 0, 0); // Red
delay(1000);
setColor(0, 255, 0); // Green
delay(1000);
setColor(0, 0, 255); // Blue
delay(1000);
setColor(255, 255, 0); // Yellow
delay(1000);
setColor(80, 0, 80); // Purple
delay(1000);
setColor(0, 255, 255); // Cyan
delay(1000);
}
void setColor(int red, int green, int blue) {
// For common-anode RGB LEDs, use 255 minus the color value
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}