Monday, September 22, 2014

Code for "There and Back Again: For Loop"

Here is the code that I used in the For Loop to make the LEDs light there and back again.


void loop()
{

  for (int led=13; led>=3; led--)
  {
    pinMode (led,OUTPUT);
    digitalWrite (led, HIGH);
    delay (100);
    digitalWrite (led, LOW);
   
  }
 
  for (int led=3; led<=13; led++)
  {
    pinMode (led, OUTPUT);
    digitalWrite (led, HIGH);
    delay (100);
    digitalWrite (led, LOW);
  }
 

No comments:

Post a Comment