Menu Close

Arduino Nano Digital Output – LED Blinking

arduino-nano-digital-output-led-blinking

This tutorial explains how to take digital output from Arduino Nano. The output is taken on a LED that blinks for an interval of 1 second.

1. Introduction:

A step by step illustrated very basic tutorial for Arduino Nano. Here we are taking digital output on a LED. This LED remains ON for one second and OFF for another, this loop runs for an infinite time.

1.1 LED Pins:

LED has two pin interface. Both of these pins are to be given input supply to the LED. Long legs is for positive supply the smaller one is for negative supply. following image depicts it clearly.

Digital means either 0/1, in other words HIGH/LOW or ON/OFF. So in the form of digital output we shall get either +5V or 0V on digital pin of Arduino. How does it happen that is illustrated ahead.

S.No.ItemQuantity
1. Arduino Nano 1
2. Mini USB Cable 1
3. Breadboard 1
4. LED 1
5. Resistor 220 Ohm 1
6. Male to Male Jumper Wires 2

2. Building Circuit

Schematic Diagram:

Circuit Layout:

3. Programming:

Once we are done with circuit part, here is our programme to this circuit.

You may download this code (Arduino Sketch) from here.

// Digital output tutorial by ROBO INDIA
// www.roboindia.com
// Digital output is taken on a LED that remains ON for one second and OFF for another second

const int LED = 13;  // from the circuit we can see that we have connected LED on Pin 13


void setup() 
{                
    pinMode(LED, OUTPUT); // Defining LED pin as OUTPUT Pin.   
}

// Below mentioned code runs for ever(infinite loop)
void loop() {
  digitalWrite(LED, HIGH); // LED gets turned ON (1/HIGH/+5V)
  delay(1000);             // Waiting for one second. 
  digitalWrite(LED, LOW);  // LED gets OFF (0/LOW/0V/GND)
  delay(1000);        // here and above Delay is in mili second (1000 = 1 second)
}

 4. Output:

The execution of this code makes led ON for one second and OFF for another one second in infinite loop.

 5. Troubleshooting:

LED is not glowing: Try changing polarity of LED, Pull it out rotate it by 180 degree and insert its again.

If still not working pull the led out and test it may be defective

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

1 Comment

Leave a Reply