const uint8_t ledPins[] = { 0, 2, 4, 15, 16 };
uint8_t currentState = 0; //Estado actual
uint8_t numStates = sizeof(ledPins); //Posibles estados
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.print("Tamaño del array: ");
Serial.println(sizeof(ledPins));
for(int i = 0; i < sizeof(ledPins); i++){
pinMode(ledPins[i], OUTPUT);
}
}
void loop() {
actualizaSecuenciador();
currentState++;
if(currentState >= numStates){
currentState = 0;
}
// put your main code here, to run repeatedly:
delay(1000); // this speeds up the simulation
}
void actualizaSecuenciador() {
for(int i = 0; i < numStates; i ++) {
digitalWrite(ledPins[i], LOW);
}
digitalWrite(ledPins[currentState], HIGH);
}