Working with LED

Working with LED © GPL3+

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

  • 378 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

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 11,269 views
  • 7 comments
  • 29 respects

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 22,184 views
  • 4 comments
  • 42 respects

LED Dice

Project showcase by EvdS

  • 17,383 views
  • 11 comments
  • 66 respects

Controlling LED Brightness Using Bolt and Arduino

Project tutorial by Devashish Gupta

  • 1,766 views
  • 5 comments
  • 14 respects

LED Cube

Project tutorial by Praditha Alwis

  • 5,936 views
  • 0 comments
  • 14 respects

Multicolor Knight Rider with RGB PL9823 LED + Arduino UNO

Project tutorial by Giovanni Gentile

  • 4,764 views
  • 0 comments
  • 11 respects
Add projectSign up / Login