Assignment 2.1

posted Jun 19, 2010, 10:05 PM by Unknown user
A little late, I know.
 
 
 
int ledPin13 =  13;    // LED connected to digital pin 13
int ledPin10 =  10;    // LED connected to digital pin 10
int ledPin9 = 9;       // LED connected to digital pin 9
int ledPin8 = 8;       // LED connected to digital pin 8
int ledPin7 = 7;       // LED connected to digital pin 7
// The setup() method runs once, when the sketch starts
void setup()   {               
  // initialize the digital pin (7, 8, 9, 10 and 13) as an output:
  pinMode(ledPin13, OUTPUT); 
  pinMode(ledPin10, OUTPUT); 
  pinMode(ledPin9, OUTPUT);
  pinMode(ledPin8, OUTPUT);
  pinMode(ledPin7, OUTPUT);
}
 
// the loop() method runs over and over again,
// as long as the Arduino has power
 
void loop()   {
  digitalWrite(ledPin13, HIGH);   // set the LED (13) on
  delay(100);                  // wait for 100 milliseconds
  digitalWrite(ledPin10, HIGH);   // set the LED (10) on
  delay(100);                  // wait for 100 milliseconds
 
  digitalWrite(ledPin13, LOW);    // set the LED (13) off
  digitalWrite(ledPin9, HIGH);    // set the LED (9) on
  delay(100);                  // wait for 100 milliseconds
 
  digitalWrite(ledPin10, LOW);    // set the LED (10) off
  digitalWrite(ledPin8, HIGH);    // set LED (8) on
  delay(100);                  // wait for 100 milliseconds
 
  digitalWrite(ledPin9, LOW);     // set the LED (9) off
  digitalWrite(ledPin7, HIGH);    // set LED (7) on
  delay(100);                  // wait for 100 milliseconds
 
  digitalWrite(ledPin8, LOW);     // set LED (8) off
  delay(100);                  // wait for 100 milliseconds
  digitalWrite(ledPin8, HIGH);    // set LED (8) on
  delay(100);                  // wait for 100 milliseconds
 
  digitalWrite(ledPin7, LOW);     // set LED (7) off
  digitalWrite(ledPin9, HIGH);    // set LED (9) on
  delay(100);                    // wait for 100 milliseconds
 
  digitalWrite(ledPin8, LOW);      // set LED (8) off
  digitalWrite(ledPin10, HIGH);    // set LED (10) on
  delay(100);                    // wait for 100 milliseconds
 
  digitalWrite(ledPin9, LOW);      // set LED (9) off
  digitalWrite(ledPin13, HIGH);    // set LED (13) on
  delay(100);                   // wait for 100 milliseconds
  digitalWrite(ledPin10, LOW);     // set LED (10) off 
}
 
Comments