const int LED_PINS[] = {32,33,25,26,27,14,12,13};
const int NUM_LEDS = sizeof(LED_PINS)/sizeof(int);
#define OFF (LOW)
#define ON (HIGH)
const int PWM_RESOLUTION = 8;
const int PWM_FREQ = 1000;
const int DUTY_MAX = (1 << PWM_RESOLUTION);
void setup() {
for (int i=0; i < NUM_LEDS; i++) {
ledcSetup( i /*channel*/, PWM_FREQ, PWM_RESOLUTION );
ledcAttachPin( LED_PINS[i] /*pin*/, i /*channel*/ );
}
}
void loop() {
static uint16_t value_1=0;
static uint16_t value_2=1;
static uint16_t value_3=2;
static uint16_t value_4=3;
// put your main code here, to run repeatedly:
for ( int i=0; i < NUM_LEDS; i++ ) {
if (i == value_1){
ledcWrite(i, (DUTY_MAX-1)*10/100);
}else if (i == value_2) {
ledcWrite(i, (DUTY_MAX-1)*25/100);
}else if (i == value_3) {
ledcWrite(i, (DUTY_MAX-1)*50/100);
}else if (i == value_4) {
ledcWrite(i, DUTY_MAX-1);
}else {ledcWrite(i, 0);}
}
value_1 = (value_1+1) % NUM_LEDS;
value_2 = (value_2+1) % NUM_LEDS;
value_3 = (value_3+1) % NUM_LEDS;
value_4 = (value_4+1) % NUM_LEDS;
delay(500);
}