const byte ledPins[] = {13, 14, 15};
const byte chns[] = {0, 1, 2};
void setup() {
Serial.begin(9600);
for (int i = 0; i < 3; i++) {
ledcSetup(chns[i], 1000, 8);
ledcAttachPin(ledPins[i], chns[i]);
}
}
void loop() {
int colors[7][3] = {
{148, 0, 211},
{0, 0, 255},
{0, 255, 255},
{0, 255, 0},
{255, 255, 0},
{255, 127, 0},
{255, 0, 0}
};
String colorNames[7] = {
"Violeta",
"Azul",
"Ciano",
"Verde",
"Amarelo",
"Laranja",
"Vermelho"
};
for (int i = 0; i < 7; i++) {
int redValue = colors[i][0];
int greenValue = colors[i][1];
int blueValue = colors[i][2];
ledcWrite(chns[0], 255 - redValue);
ledcWrite(chns[1], 255 - greenValue);
ledcWrite(chns[2], 255 - blueValue);
Serial.print("Cor atual: ");
Serial.println(colorNames[i]);
Serial.print("PWM do LED RED: ");
Serial.println(255 - redValue);
Serial.print("PWM do LED GREEN: ");
Serial.println(255 - greenValue);
Serial.print("PWM do LED BLUE: ");
Serial.println(255 - blueValue);
Serial.println();
delay(1000);
}
}