Aim:
Light Emitting Diodes (LED) is the most commonly used components, usually for displaying pins digital states. Typical uses of LEDs include alarm devices, timers and confirmation of user input such as a mouse click or keystroke. The main aim of this project is how to interface a single LED to arduino.
Description:
Interfacing LED:
Fig. 1 shows how to interface the LED to microcontroller. As you can see the Cathode is connected through a resistor to GND & the Anoode is connected to the Microcontroller pin. So when the Port Pin is HIGH the LED is ON & when the Port Pin is LOW the LED is turned OFF.
We now want to flash a LED in arduino board. It works by turning ON a LED & then turning it OFF & then looping back to START. However the operating speed of microcontroller is very high so the flashing frequency will also be very fast to be detected by human eye.
Block Diagram
Schematic:
Code:
// ***********************************************************
// Project: Interfacing Single LED to Arduino
// Author: Hack Projects
// Module description: Operate single LED
// ***********************************************************
const int LED = 13;
void setup()
{
pinMode(LED,OUTPUT);
}
void loop()
{
digitalWrite(LED,HIGH);
delay(1000);
digitalWrite(LED,LOW);
delay(1000);
}
Downloads:
The code was compiled in Atmel Studio 6 and simulation was made in Proteus v7.7.
To download code and proteus simulation click here.
Further Reading suggestions:
You may also like,
- Interfacing keypad with Arduino
- nterfacing DAC with Arduino
- Interfacing with UART of Arduino controller
- Interfacing SPI communication with Arduino
- Arduino Displaying Custom Characters on LCD
- Arduino Graphical LCD
- RTC interfacing using I2C in Arduino
- Interfacing ultrasonic sensor with Arduino
- Interfacing GPS Modu with Arduino
- Interfacing GSM Module with Arduino
- Interfacing PWM in Arduino
- Interfacing ADC with Arduino
- Scrolling string on LCD using Arduino
- Interfacing keypad with Arduino
- nterfacing DAC with Arduino
- Interfacing with UART of Arduino controller
- Interfacing SPI communication with Arduino
- Arduino Displaying Custom Characters on LCD
- Arduino Graphical LCD
- RTC interfacing using I2C in Arduino
- Interfacing ultrasonic sensor with Arduino
- Interfacing GPS Modu with Arduino
- Interfacing GSM Module with Arduino
- Interfacing PWM in Arduino
- Interfacing ADC with Arduino
- Scrolling string on LCD using Arduino