Skip to main content

social

pop

Interfacing a Light Emitting Diode (LED) with Arduino

 Interfacing a Light Emitting Diode (LED) with Arduino

What is a LED?

A light-emitting diode (LED) is a semiconductor device that produces light when an electric current flows through it.

Applications: Indicators, Displays such as Matrix display, Led bulbs etc.
LED (Light Emitting Diode)

Proteus Circuit of Turning on LED

Proteus Circuit of Turning on LED with Arduino


Arduino Code

void setup() {
  // put your setup code here, to run once:
pinMode (7,OUTPUT);   // pin 7 (LED pin) configured as an output
digitalWrite(7,HIGH);    // command to turn ON LED 
}

void loop() {
  // put your main code here, to run repeatedly:

}


Interfacing a Light Emitting Diode (LED) with Arduino

 

Arduino Code for Turning ON/OFF LED Twice

void setup() {
  // put your setup code here, to run once:
pinMode (7,OUTPUT);   // pin 7 (LED pin) configured as an output
digitalWrite(7,HIGH);     // command to turn ON LED 
delay(1000);                  // command for a 1 second delay
digitalWrite(7,LOW);    // command to turn OFF LED 
delay (1000);                // command for a 1 second delay
digitalWrite(7,HIGH);
delay(1000);                  // command for a 1 second delay
digitalWrite(7,LOW);    // command to turn OFF LED 
}

void loop() {
  // put your main code here, to run repeatedly:

}

Arduino Code for Repeated turning ON/OFF

void setup() {
  
pinMode (7,OUTPUT);   // pin 7 (LED pin) configured as an output

}

void loop() {
  // put your main code here, to run repeatedly:

digitalWrite(7,HIGH);     // command to turn ON LED 
delay(1000);                  // command for a 1 second delay
digitalWrite(7,LOW);    // command to turn OFF LED 
delay (1000);                // command for a 1 second delay

}