User:1sfoerster/enes100/fall2013/p2BioFeed/program

//LED Pin Variables int ledPins[] = {2,3,4}; int lightModulo = 0; // for which modulo to light void setup { for(int i = 0; i < 4; i++){         //this is a loop and will repeat eight times pinMode(ledPins[i],OUTPUT); //we use this to set each LED pin to output }                                  //the code this replaces is below Serial.begin(9600); } void loop                    // run over and over again { turnOnEvenOdd; } // turn on even LEDs, then odd LEDs. // nice to have them set up as yellow/red void turnOnEvenOdd { int delayTime = 250; // print desired modulo. Serial.println(lightModulo); for (int i = 0; i < 4; i++) { if ((i % 2) == lightModulo) {

digitalWrite(ledPins[i], HIGH); } else {

digitalWrite(ledPins[i], LOW); } }

lightModulo--;                  // decrease. 1 turns to 0, 0 turns to -1 lightModulo = abs(lightModulo); // when it's -1 (from 0), abs to 1 delay(delayTime); }