Introduction: Project1 LED
Inspiration for this project came from ring lights in the below video from 0:22-0:28
And below you can download the video of my result.
Attachments
Step 1: Step 1: Identify the Positive Side of Your LED
The positive side will have a longer metal leg than the negative.
Step 2: Step 2: Place LED in the Breadboard
Place the LED as such in your breadboard with the negative leg in the blue ground lane.
Step 3: Step 3: Add Resistor
For this example I am placing a 100 ohm resistor in the same column as the LED. To calculate what resistor is needed for your LED use the formula found at http://www.ohmslawcalculator.com/led-resistor-calculator.
Step 4: Step 4: Connect Wire to Breadboard
Connect a wire to the column that the LED and resistor are in.
Step 5: Step 5: Insert Wire Into Pin
With your Arduino board unplugged insert the other end of the wire into pin 3 on your board.
*Note for this project I am using pins 3,5,6,9,10,11 as they are the pins on my Arduino Uno board that have PWM indicated by the ~ next to the number, check your board's specifications to select pins that also have PWM.
Step 6: Step 6: Repeat
Repeat steps 2-5, 5 more times
Step 7: Step 6: Ground
Place a wire in the blue ground lane.
Step 8: Step 8: Ground Part 2
Insert the ground wire into the ground pin on your board.
Step 9: Step 9: Upload Code
You can now plug your Arduino into your computer and upload your code to it, or copy the code below.
/*
Project1 LED EffectDims up multiple LEDs at once, then dims all down, then chases multiple LEDs in sequence.
The circuit: - LEDs from pins 2 through 7 to ground
created 2018 by Steven Johnson */
int timer = 80; // The higher the number, the slower the timing.
void setup() { // use a for loop to initialize each pin as an output: for (int thisPin = 2; thisPin < 12; thisPin++) { pinMode(thisPin, OUTPUT); } }
void loop() { // iterate over the pins: for (int thisPin = 2; thisPin < 12; thisPin++) { // fade the LED on thisPin from off to brightest: for (int brightness = 0; brightness < 255; brightness++) { analogWrite(thisPin, brightness); } } // pause between LEDs: delay(1250);
// fade the LED on thisPin from brightest to off: for (int brightness = 255; brightness >= 0; brightness--) { analogWrite(3, brightness); analogWrite(5, brightness); analogWrite(6, brightness); analogWrite(9, brightness); analogWrite(10, brightness); analogWrite(11, brightness); delay(2); }
// loop from the lowest pin to the highest:
// turn the pin on: analogWrite(3, 255); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(5, 255); analogWrite(3, 180); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(6, 255); analogWrite(5, 180); analogWrite(3, 80); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(9, 255); analogWrite(6, 180); analogWrite(5, 80); analogWrite(3, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(10, 255); analogWrite(9, 180); analogWrite(6, 80); analogWrite(5, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(11, 255); analogWrite(10, 180); analogWrite(9, 80); analogWrite(6, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(3, 255); analogWrite(11, 180); analogWrite(10, 80); analogWrite(9, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(5, 255); analogWrite(3, 180); analogWrite(11, 80); analogWrite(10, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(6, 255); analogWrite(5, 180); analogWrite(3, 80); analogWrite(11, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(9, 255); analogWrite(6, 180); analogWrite(5, 80); analogWrite(3, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(10, 255); analogWrite(9, 180); analogWrite(6, 80); analogWrite(5, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(11, 255); analogWrite(10, 180); analogWrite(9, 80); analogWrite(6, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(11, 180); analogWrite(10, 80); analogWrite(9, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(11, 80); analogWrite(10, 0); delay(timer); // turn the pin off:
// turn the pin on: analogWrite(11, 0); delay(timer); // turn the pin off: }