This is a simple guide on how to connect an LED to your Arduino and make it fade in and then out.
Step 1: What Will You Need?
All you need is your Arduino, an LED and a USB cable.
In this example we've used an Arduino Uno and a simple white LED.
Step 2: How It Works
Here you can see the basic of Pulse Width Modulation (PWM).
PWM is a modulation technique that conforms the width of the pulse of a signal.
Although this modulation technique can be used to encode information for transmission,
its main use is to allow the control of the power supplied to electrical devices,
especially to inertial loads such as motors.
Step 3: Connect the LED to Your Arduino
Ok, this is really simple. Just place the long pin of your LED to your Arduino's ~10 digital output. The short pin must be connected to the board's Gnd. It should be right next to output 13.
Make sure you do this step right and let's move to the next step!
Step 4: Connect Your Arduino to Your Computer.
Use your USB cable to connect your Arduino device to your computer.
The whole setup should look like the picture.
Step 5: Program Your Arduino
In this step, we will program our Arduino.
I've embedded my Codebender project so you can just use it, doing the following.
The uploading process is really easy and quick, provided that you have installed the Codebender plugin
to your browser (Chrome or Firefox).
Just 3 simple things to do :
- Select Arduino Uno from the board selection.
- Select the correct serial port from the port selection.
- Hit "Run on Arduino".
Step 6: Enjoy!
So, you' re done! You must now see the LED fading in and out!