Interfacing a Single LED with Arduino Board

       In this project, we will demonstrate how to interface a single LED (Light Emitting Diode) with an Arduino board. The Arduino board will be programmed to control the LED and make it blink at a specific rate.

Hardware Required:

  1. Arduino board (e.g., Arduino Uno)
  2. LED module
  3. Resistor (220-470 ohms)
  4. Jumper wires

Circuit Diagram: Connect the components as follows:

Connections:    

Arduino Uno            Led Module
5vVcc(5v)
Digital pin7Led pin 1

Code: Below is the Arduino code to control the LED:

//Developed by www.projectkitsandparts.com Pune.

// Define the pin connected to the LED

const int ledPin = 7;

void setup() {

  // Set the LED pin as an output

  pinMode(ledPin, OUTPUT);

}

void loop() {

  // Turn the LED on

  digitalWrite(ledPin, HIGH);

  // Wait for 1 second

  delay(1000);

  // Turn the LED off

  digitalWrite(ledPin, LOW);

  // Wait for 1 second

  delay(1000);

}

Code Explanation:

  1. The ledPin variable is declared and set to 13, which corresponds to the pin connected to the LED.
  2. In the setup() function, the ledPin is set as an output using the pinMode() function.
  3. The loop() function is where the LED control happens.
  4. The LED is turned on by setting the ledPin to HIGH using digitalWrite().
  5. The program waits for 1 second using delay(1000).
  6. The LED is turned off by setting the ledPin to LOW.
  7. Another 1-second delay is added.
  8. The loop repeats, toggling the LED on and off continuously.

Code Manual:

  • Connect the Arduino board to your computer via USB.
  • Open the Arduino IDE (Integrated Development Environment) on your computer.
  • Create a new sketch and copy-paste the code provided into the IDE.
  • Make sure the correct Arduino board and port are selected under the “Tools” menu.
  • Click the “Upload” button to compile and upload the code to the Arduino board.
  • You should see the LED blinking at a 1-second interval.

Note: If you connected the LED to a different pin, make sure to update the ledPin variable in the code accordingly.

You have successfully interfaced a single LED with an Arduino board.

Project Module:

Leave a Reply

Your email address will not be published. Required fields are marked *

Shop
Sidebar
0 Wishlist
0 Cart