Friday, September 12, 2014

int led=7;
int LED=3;

void setup() {               
  // initialize the digital pin as an output.

  for (int led=7; led>=3; led=led-1)
  {
    pinMode(led,OUTPUT);


  }

}
// the loop routine runs over and over again forever:
void loop()
{
  for(int led=7; led>3; led=led-1)
  {
    digitalWrite(led, HIGH);
    digitalWrite(LED, HIGH);
    delay (200);        
    digitalWrite(led, LOW);
    digitalWrite(LED, LOW);
    LED=LED+1;
      if(LED>=7)
    {
      LED=3;
    }
 
  }


This is the code that causes a system of 5 LEDs to turn on the outside 2 LEDs, then from both sides move to the middle LED and back to the outside LEDs.

No comments:

Post a Comment