Lab1 Submission

Posted by wendy.xue

Anonymous's picture

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