Programming Examples

Arduino program to Blink a Light Emitting Diode LED


blink a LED

Write a program using Arduino to Blink a Light Emitting Diode (LED). Also describe the connections used in a circuit with the Arduino Uno development board.

Components Needed:

  • Arduino Uno
  • LED
  • Resistor (for LED current limiting)

Circuit Connections:

  • Connect the cathode (shorter leg) of the LED to the digital pin 13 on the Arduino.
  • Connect the anode (longer leg) of the LED to the ground (GND) on the Arduino.

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000); // Wait for 1000 millisecond(s)
  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000); // Wait for 1000 millisecond(s)
}

Output


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz