//LED Pin Variables
int ledPins[] = {2,3,4,5,6,7,8,9}; //An array to hold the pin each LED is connected to
//i.e. LED #0 is connected to pin 2, LED #1, 3 and
//so on to address an array use ledPins[0] this
//would equal 2 and ledPins[7] would equal 9
int pattern[] = {HIGH,LOW,HIGH,LOW,HIGH,LOW,HIGH,LOW};
/*
* setup() - this function runs once when you turn your Arduino on
* We the three control pins to outputs
*/
void setup()
{
for(int i = 0; i < 8; i++)
{ //this is a loop and will repeat eight times
pinMode(ledPins[i],OUTPUT); //we use this to set each LED pin to output
}
}
/* loop() - this function will start after setup finishes and then repeat
*/
void loop() // run over and over again
{
for (int i=0; i<8; i++)
{
digitalWrite(ledPins[i], pattern[i]);
}
}