#define TRUE 1
#define FALSE 0
const int numLEDs=4;
const int GPIO_Pins[]={5,4,3,2};
const int blinkRate=1000;
static bool flag=TRUE;
void setup() {
// put your setup code here, to run once:
for(int led=0;led<numLEDs;led++)
{
pinMode(GPIO_Pins[led],OUTPUT);
}
}
void loop() {
// put your main code here, to run repeatedly:
for(int led=0;led<numLEDs;led++)
{
controlLEDs(led,flag);
}
delay(blinkRate);
flag=!flag;
}
void controlLEDs(int led,bool state)
{
if(state==TRUE)
digitalWrite(GPIO_Pins[led],HIGH);
else
digitalWrite(GPIO_Pins[led],LOW);
}