Arduino -Led

Prerequisites

  • Arduino Board UNO ( Hardware)
  • Arduino IDE (Software)
  • USB Cable
  • Led
  • Wires

Connections

You can either use the built-in led 13 or any external led with Arduino.

  • Connect Anode (+) side of Led with Digital pin of Arduino i.e 13
  • Connect Cathode(-) side of Led to Ground pin of Arduino

Interfacing Diagram

Code

void setup() {

  // initialize digital pin LED_BUILTIN as an output.

  pinMode(13, OUTPUT);

}



void loop() {

  digitalWrite(13, HIGH);   // turn the LED on

  delay(1000);              // wait for a second

  digitalWrite(13, LOW);    // turn the LED off   delay(1000);              // wait for a second

}

0 Comments

Leave a Reply

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