Working with Two LEDs

Working with Two LEDs © GPL3+

This project demonstrates working with two LEDs and Arduino.

  • 568 views
  • 2 comments
  • 3 respects

Components and supplies

Apps and online services

About this project

This project demonstrates working with two LEDs and Arduino.

Objective

  • Blinking of two LEDs (alternating)
  • Fading effect of two LEDs (alternating)
Working with two LEDs

Code

Blinking of two LEDArduino
const int LED_red = 3;
const int LED_green = 6;

void setup() {
    pinMode (LED_red, OUTPUT);
    pinMode (LED_red, OUTPUT);
}

void loop() {
    digitalWrite (LED_red, HIGH);
    digitalWrite (LED_green, LOW);
    delay (1000);
    digitalWrite (LED_red, LOW);
    digitalWrite (LED_green, HIGH);
    delay (1000);
}
Fading effects of two LEDsArduino
const int LED_red = 3;
const int LED_green = 6;

void setup() {
    pinMode (LED_red, OUTPUT);
    pinMode (LED_green, OUTPUT);
}

void loop() {
    for (int brightness=1; brightness<=255; brightness++)
    {
      analogWrite (LED_red, brightness);
      delay (5);
    }
    for (int brightness=255; brightness>0; brightness--)
    {
      analogWrite (LED_green, brightness);
      delay (5);
    }
    for (int brightness=255; brightness>0; brightness--)
    {
      analogWrite (LED_red, brightness);
      delay (5);
    }
    for (int brightness=1; brightness<=255; brightness++)
    {
      analogWrite (LED_green, brightness);
      delay (5);
    }
}

Schematics

Circuit: Working with two LED
Make Connections as shown in the figure
Circuit working with 2leds 3t9mmdobcf
Schematic Diagram
Working with two led zsvfodonba

Comments

Similar projects you might like

Sound Sensor Activated LEDs with LCD for Sound Level Data!

Project tutorial by HeathenHacks

  • 5,466 views
  • 5 comments
  • 17 respects

Working with Shift Register

by SBR

  • 3,372 views
  • 2 comments
  • 8 respects

Motion and Light Dependent LEDs

Project in progress by Joaquim Silveira

  • 2,126 views
  • 2 comments
  • 10 respects

Arduino Door Bell with 3 LEDs

Project showcase by Team abhishekghosh

  • 4,379 views
  • 2 comments
  • 7 respects

Blinking LEDs with Arduino

Project tutorial by Super Kid

  • 3,779 views
  • 2 comments
  • 17 respects

Metronome with LEDs & Tone

Project tutorial by Ryaebi

  • 2,134 views
  • 2 comments
  • 9 respects
Add projectSign up / Login