Array

Array

 


int pinArray[] = {3, 5, 6, 9, 10, 11};
//int count = 0;
int pinCount = 6;
//int timer = 30;
int ledFade[6];
int i;
int prevTime;
int interval = 200;
void setup(){
for (i = 0; i < pinCount; i++) {
pinMode(pinArray[i], OUTPUT);
}
Serial.begin(9600);
Serial.println();
Serial.println("Begin");
}
void loop() {
for (i=0;i<5;i++) {
digitalWrite(pinArray[i], HIGH);
delay(interval);
digitalWrite(pinArray[i + 1], HIGH);
delay(interval);
digitalWrite(pinArray[i], LOW);
delay(interval);
}
for (i=5;i>0;i–) {
digitalWrite(pinArray[i], HIGH);
delay(interval);
digitalWrite(pinArray[i – 1], HIGH);
delay(interval);
digitalWrite(pinArray[i], LOW);
delay(interval);
}
}

view raw

ArrayPingPong

hosted with ❤ by GitHub