/* Program 2-3: Toggling Three pins Sequentially * This program uses an array to index to each LED. */ const int PINS[] = {5, 9, 10}; /* 3 pins */ void setup() { /* configure pins for output */ for (int i = 0; i < 3; i++) { pinMode(PINS[i], OUTPUT); } } void loop() { /* turn PINS on one at a time */ for (int i = 0; i < 3; i++) { digitalWrite(PINS[i], HIGH); /* turn PINS on */ delay(500); /* for 500 ms */ digitalWrite(PINS[i], LOW); /* turn the same PINS off */ } }