const int LED_PINS[] = {21, 19, 18, 5, 4, 2, 15, 22};
const int NUM_LEDS = sizeof(LED_PINS) / sizeof(int);
#define OFF (HIGH) // active-low LED
void setup() {
for ( int i = 0; i < NUM_LEDS; i++ ) {
// set the direction of the i-th LED pin
pinMode( LED_PINS[i], OUTPUT );
digitalWrite( LED_PINS[i], OFF );
}
}
const int PWM_RESOLUTION = 8;
const int PWM_FREQ = 1000;
const int DUTY_MAX = (1 << PWM_RESOLUTION);
const float DUTY_CYCLES[] = {0.1,0.25,0.5,1};
void loop() {
for ( int i=0; i < NUM_LEDS; i++) {
for ( int j=0; j < 4; j++) {
ledcSetup( j, PWM_FREQ, PWM_RESOLUTION );
ledcAttachPin( LED_PINS[(i+j)%NUM_LEDS], j );
ledcWrite( j, (1 - DUTY_CYCLES[j])*DUTY_MAX );
}
delay(100);
for ( int j=0; j < 4; j++) {
ledcDetachPin( LED_PINS[(i+j)%NUM_LEDS] );
digitalWrite( LED_PINS[(i+j)%NUM_LEDS], OFF );
}
}
}
esp32:VIN
esp32:GND.2
esp32:D13
esp32:D12
esp32:D14
esp32:D27
esp32:D26
esp32:D25
esp32:D33
esp32:D32
esp32:D35
esp32:D34
esp32:VN
esp32:VP
esp32:EN
esp32:3V3
esp32:GND.1
esp32:D15
esp32:D2
esp32:D4
esp32:RX2
esp32:TX2
esp32:D5
esp32:D18
esp32:D19
esp32:D21
esp32:RX0
esp32:TX0
esp32:D22
esp32:D23
r8:1
r8:2
r9:1
r9:2
r10:1
r10:2
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
r1:1
r1:2
r2:1
r2:2
r3:1
r3:2
r4:1
r4:2
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
led8:A
led8:C
r5:1
r5:2