Thursday, 13 June 2013

17 - 2 LEDs Variations

/*
  Two LEDs
  Turns on an LED on for one second, then off for one second, repeats with other LED.
 */


// give LEDs a name:
int led = 12;
int led2 = 13;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);  
  digitalWrite(led2, HIGH);   
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);   
  digitalWrite(led2, LOW);    
  delay(1000);               // wait for a second
}

No comments:

Post a Comment