// declare variables: int switchPin = 7; // digital input pin for a switch int whitepinArray[] = { 2,3,4,5,6 }; // Array where I declare the pins connected to the LEDs int bluepinArray[] = { 8,9,10,11,12 }; // Array where I declare the pins connected to the LEDs int switchState = 0; // the state of the switch int waitNextLed = 100; // Time before I light up the next LED int tailLength = 3; // Number of LEDs that stay lit befor I start turning them off, thus the tail int lineSize = 5; // Number of LEDs connected (which also is the size of the pinArray) void setup() { int i; int j; for (i=0; i< lineSize; i++) { pinMode(whitepinArray[i], OUTPUT); } for (j=0; j< lineSize; j++) { pinMode(bluepinArray[j], OUTPUT); } pinMode(switchPin, INPUT); // set the switch pin to be an input } void loop() { // read the switch input: switchState = digitalRead(switchPin); int i; int j; int tailCounter = tailLength; // I set up the tail length in a counter if (switchState == 1) { // if the switch is closed: for (i=0; i 0) tailCounter--; } for (i=(lineSize-tailLength); i 0) tailCounter--; } for (j=(lineSize-tailLength); j