Working with LED

Working with LED © GPL3+

A step by step procedure to work with LED using Arduino.

  • 2,707 views
  • 0 comments
  • 6 respects

Components and supplies

Apps and online services

About this project

This is my first Arduino project. I am documenting on what I learnt from the Arduino Starter Guide by Roboindia.

Objective:

  • Make the LED ON forever
  • Blinking of LED
  • Make the LED ON for 2 seconds then OFF for 3 seconds
  • Fading effect of LED
  • Fade in and Fade out at different Speeds

Working with LED

Code

LED forever ONArduino
const int LED = 3;

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

void loop() {
    digitalWrite (LED, HIGH);
    
}
Blinking of LEDArduino
const int LED = 3;

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

void loop() {
    digitalWrite (LED, HIGH);
    delay (1000);
    digitalWrite (LED, LOW);
    delay (1000);
}
LED ON for 2s and OFF for 3sArduino
const int LED = 3;

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

void loop() {
    digitalWrite (LED, HIGH);
    delay (2000);
    digitalWrite (LED, LOW);
    delay (3000);
}
Fading Effects of LEDArduino
const int LED_ao = 3;

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

void loop() {
    for (int brightness=1; brightness<=255; brightness++)
    {
      analogWrite (LED_ao, brightness);
      delay (10);
    }
    for (int brightness=255; brightness>0; brightness--)
    {
      analogWrite (LED_ao, brightness);
      delay (10);
    }
}
Fade IN and Fade OUT at different speedsArduino
const int LED_ao = 3;

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

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

Schematics

Circuit Diagram
Created using Visio Professional
Working with led lv2pev31eq
Breadboard Diagram
Make connections as shown in the figure.
Working with led ixhbqyutvz
Schematic Diagram
Working with led ytsdhbhv0e

Comments

Similar projects you might like

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 41,094 views
  • 9 comments
  • 59 respects

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 23,090 views
  • 10 comments
  • 42 respects

Arduino tutorial: LED Matrix red 32x8 256 Led

Project showcase by Bihari lifehacker

  • 7,254 views
  • 0 comments
  • 6 respects

Working with Shift Register

by SUMAN BARGAV R

  • 10,779 views
  • 4 comments
  • 11 respects

8x LED Lighting by Sound

Project tutorial by Mantas Utka

  • 11,481 views
  • 5 comments
  • 19 respects

8x8x8 RGB LED Cube

Project tutorial by John Bradnam

  • 13,551 views
  • 21 comments
  • 43 respects
Add projectSign up / Login