Lab1 Submission

Submitted by wendy.xue on Wed, 01/30/2013 - 15:55

 

Description

This is an improvement of the basic LED blink circuit with two LEDs built in a parallel circuit. The two LED will blink in different speed and toggle. The LED connected to Pin 10 blinks every 500 ms, twice, after the LED connected to the Pin 13 blinks, once, every 1000 ms. 

Components Used

- 2 LEDs

- 2 220  Ω Resistors

- 1 Arduino Uno

Code

/*

  Blink
  Toggle two LEDs, first one turned on for 1 second and turn off for 1 second, second one turned on for half a second and turn off for half a second
 */
 
// Pin 13 and Pin 10 has an LED connected on most Arduino boards.
int led = 13;
int led2 = 10;
 
// 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);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(led2, HIGH);
  delay(500);
  digitalWrite(led2, LOW);
  delay(500);
  digitalWrite(led2, HIGH);
  delay(500);
  digitalWrite(led2, LOW);
  delay(500);
}

 

 

circuit
0
Your rating: None
Drupal theme by Kiwi Themes.