#define TRUE 1
#define FALSE 2
const int num =4; //number of leds
const int GPIO[] = {0,4,10,14};
const int blink = 100;
static bool flag = TRUE;//flag is not a const as it toggles b/w true and false
void setup() {
for(int led=0;led<num;led++){
pinMode(GPIO[led], OUTPUT);
}
}
void loop() {
for(int led=0;led<num;led++){
control(led,flag);
}
delay(blink);
flag=!flag;
}
void control(int led,bool state){
if(state==TRUE)
digitalWrite(GPIO[led], HIGH);
else
digitalWrite(GPIO[led], LOW);
}