Arduino First Assignment

Night Rider

int L1 =  13;

int leds[] = {9, 10, 11, 12, 13};
int delayTimer = 100;

// The setup() method runs once, when the sketch starts

void setup()   {                
  // initialize the digital pin as an output:
  for (int i = 0; i < 6; i++)
  {
    pinMode(leds[i], OUTPUT);
  }
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()                    
{
  for (int i = 0; i < 6; i++)
  {
    digitalWrite(leds[i], HIGH);   // set the LED on
    delay(delayTimer);   
    digitalWrite(leds[i], LOW);
  }
}


Circuit #3

 

Post a comment