Introduction: LED Row Fade Arduino
For this project I created a LED row fade from left to right, based on the position of the potentiometer.
The materials needed are:
3)5 blue LEDs
4)male to male jumper wires
6)5 220ohm resistors
Step 1: Connecting the Power
Connect your wires as shown in this picture. It is very important that you use the 5v power supply so that the brightness of the LEDs will work properly. The ground is used for all the LEDs and the potentiometer, while the power is just for the potentiometer. The LEDs will be connected to the breadboard.
Step 2: Connecting the LEDs
Connect the LEDs as shown in the photo above. Be sure that the anode is connected to the resistor and arduino. The anode is the power end (longer end), and the cathode is the ground (shorter end). Make sure the LEDs are connected to the Arduino as shown. They are all connected to the PWM pins so the brightness can fluctuate.
LED1=>PWM pin 11
LED2=>PWM pin 10
LED3=>PWM pin 9
LED4=>PWM pin 6
LED5=>PWM pin 5
Step 3: Connecting Potentiometer
The potentiometer should be connected just like the picture shows. The pin used for it should be analog 2, because the potentiometer provides analog inputs.
Step 4: CODE
This is the code for the setup. If you change anything in the code, make sure the pins still line up.