How to interface LED with Arduino - Ocean of Programming

Tuesday 20 February 2018

How to interface LED with Arduino

            In this tutorial, I am going to tell you how to interface an LED with Arduino. I am using the inbuilt LED of Arduino for this tutorial. Inbuilt LED is present at pin number 13. When the output signal is HIGH then LED turns on and when the output signal is LOW then the LED is off. In between on and off provided 1000ms delay observing the output.
            In void setup, the setup is provided that is pin 13 is made as an output pin and in a void loop, the instructions are provided that executes continuously. In place of ledPin directly you can put pin number or LED_BUILTIN to connect the built-in LED.
int ledPin = 13;
void setup() {
  pinMode(ledPin,OUTPUT);
}
void loop() {
  digitalWrite(ledPin,HIGH);
  delay(1000);
  digitalWrite(ledPin,LOW);
  delay(1000);
}

Output When LED ON
Output when LED OFF
           Please feel free to comment if you find anything incorrect or you want to share more information about the topic discussed above.

No comments:

Post a Comment