How to Control LEDs With Arduino

80114

Intro: How to Control LEDs With Arduino

So in this tutorial I am going to light some leds with arduino uno board.

STEP 1: Things You Need

Arduino uno
USB 2.0 Cable type
Male to male jumper wires
LEDs
Breadboard

STEP 2: Led Explanation

a light-emitting diode (a semiconductor diode which glows when a voltage is applied).
The long side of the led is positive or plus(+) whereas the short side is negative or minus(-).

STEP 3: Setting Things

This is the setup of the project.
Connect the ground(GND) pin of the arduino board to the minus(-) side of the led.
Then connect the plus(+) side of the led to 0 pin of the arduino board(if 0 pin does not work use pin 2).
Connect the arduino board to your computer with USB 2.0 Cable.
(you don't need a resistor as shown in the photo).

STEP 4: The Code

Go to arduino IDE and name your project as led and save it.
Then write the following code.
If you use pin 2 for the (+) side of the led, then just change the number 0 of the code to 2.(pinMode 2 and digitalWrite 2).

STEP 5: Final Result

Now the led will light up if you have used the first code.
If you use the second code the light will blink.

3 Comments

You can use arduino mega arduino uno or arduino nano.