#include <Arduino.h>
const int ledPins[] = {1, 4, 5, 2, 3, 6};
const int numLeds = sizeof(ledPins) / sizeof(ledPins[0]);
const int pwmFrequency = 3639;
const int minFrequency = 1;
const int maxFrequency = 60;
void setup() {
for (int i = 0; i < numLeds; i++) {
pinMode(ledPins[i], OUTPUT);
ledcSetup(i, pwmFrequency, 8);
ledcAttachPin(ledPins[i], i);
}
}
void loop() {
for (int frequency = minFrequency; frequency <= maxFrequency; frequency++) {
for (int ledIndex = 0; ledIndex < numLeds; ledIndex++) {
// Encender gradualmente
for (int pwmValue = 0; pwmValue <= 255; pwmValue++) {
ledcWrite(ledIndex, pwmValue);
delay(8.333);
}
// Apagar gradualmente
for (int pwmValue = 255; pwmValue >= 0; pwmValue--) {
ledcWrite(ledIndex, pwmValue);
delay(8.333);
}
}
}
}
Loading
esp32-s2-devkitm-1
esp32-s2-devkitm-1