// // Define the pins for the RGB LED
// const int redPin = 9;
// const int greenPin = 10;
// const int bluePin = 11;
// void setup() {
// // Set the RGB LED pins as outputs
// pinMode(redPin, OUTPUT);
// pinMode(greenPin, OUTPUT);
// pinMode(bluePin, OUTPUT);
// }
// void loop() {
// // Set different 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 the color of the RGB LED
// void setColor(int redValue, int greenValue, int blueValue) {
// analogWrite(redPin, redValue);
// analogWrite(greenPin, greenValue);
// analogWrite(bluePin, blueValue);
// }
// Define the pins for the first RGB LED
const int redPin1 = 9;
const int greenPin1 = 10;
const int bluePin1 = 11;
// Define the pins for the second RGB LED
const int redPin2 = 6;
const int greenPin2 = 5;
const int bluePin2 = 3;
void setup() {
// Set the RGB LED pins as outputs
pinMode(redPin1, OUTPUT);
pinMode(greenPin1, OUTPUT);
pinMode(bluePin1, OUTPUT);
pinMode(redPin2, OUTPUT);
pinMode(greenPin2, OUTPUT);
pinMode(bluePin2, OUTPUT);
}
void loop() {
// Set different colors for the first RGB LED
setColor(redPin1, greenPin1, bluePin1, 255, 0, 0); // Red
delay(1000); // Wait for 1 second
setColor(redPin1, greenPin1, bluePin1, 0, 255, 0); // Green
delay(1000); // Wait for 1 second
setColor(redPin1, greenPin1, bluePin1, 0, 0, 255); // Blue
delay(1000); // Wait for 1 second
// Set different colors for the second RGB LED
setColor(redPin2, greenPin2, bluePin2, 255, 0, 0); // Red
delay(1000); // Wait for 1 second
setColor(redPin2, greenPin2, bluePin2, 0, 255, 0); // Green
delay(1000); // Wait for 1 second
setColor(redPin2, greenPin2, bluePin2, 0, 0, 255); // Blue
delay(1000); // Wait for 1 second
}
// Function to set the color of the RGB LED
void setColor(int redPin, int greenPin, int bluePin, int redValue, int greenValue, int blueValue) {
analogWrite(redPin, redValue);
analogWrite(greenPin, greenValue);
analogWrite(bluePin, blueValue);
}