Are you looking for a simple electronics project to get some practice with Arduino and PWM? Try this out!

Here's what you need:

1 x Arduino UNO + USB cable

6 x Colour LED's of your choice (I used 3 red, 3 yellow)

6 x 1k Resistors

8 x Male-to-male jumper cables (I used 6 orange ones for the PWM signals and 2 for GND)

4 x Short breadboard wires to make common grounds from the LED's

1 x Mini prototyping breadboard

The 1k resistors are probably overkill, you can use less ohmage for more brightness. Just be careful not to draw more than 40mA per output pin or sink more than 200mA per ground pin.

Step 1: Wire Up the Circuit As Shown in the Image:

***NOTE: the LED cathodes (i.e. the pin at the flat edge) are negative, so they connect to ground. Wiring the LED's in reverse might destroy your Arduino.***

Step 2: Copy or Download the Code Below & Upload to Arduino

6 LED Christmas Lights

This example shows how to fade six LED's on the pwm pins

using the analogWrite() function.

This concept code is based on the single led 'fade' example sketch.


int ledPin1 = 3; // first LED on pin 3

int ledPin2 = 5; // second LED on pin 5

int ledPin3 = 6; // third LED on pin 6

int ledPin4 = 9; // fourth LED on pin 9

int ledPin5 = 10; // fifth LED on pin 10

int ledPin6 = 11; // sixth LED on pin 11

int brightness1 = 0; // minimum brightness

int brightness2 = 255; // maximum brightness

int fadeAmount = 51; // how many points to fade the LED by

// the setup routine runs once when you press reset:

void setup() {

// declare led pins to be outputs:

pinMode(ledPin1, OUTPUT);

pinMode(ledPin2, OUTPUT);

pinMode(ledPin3, OUTPUT);

pinMode(ledPin4, OUTPUT);

pinMode(ledPin5, OUTPUT);

pinMode(ledPin6, OUTPUT); }

// the loop routine runs over and over again forever:

void loop() {

// set the brightness of LED's:

analogWrite(ledPin1, brightness1);

analogWrite(ledPin2, brightness2);

analogWrite(ledPin3, brightness1);

analogWrite(ledPin4, brightness2);

analogWrite(ledPin5, brightness1);

analogWrite(ledPin6, brightness2);

// change the brightness for next time through the loop:

brightness1 = brightness1 + fadeAmount;

brightness2 = brightness2 - fadeAmount;

// reverse the direction of the fading at the ends of the fade:

if (brightness1 == 0 || brightness1 == 255){

fadeAmount = -fadeAmount;


// wait for 30 milliseconds to see the dimming effect



Step 3: Done!

If you found this instructable useful, why not stay tuned for future projects by following me on Instructables and on Facebook / Twitter:



Your support is greatly appreciated!

Happy DIY'ing!


About This Instructable




More by HobbyTransform:Arduino OLED 128X64 IIC Serial Display: printing text and moving images MPU6050: Arduino 6 Axis Accelerometer + Gyro - GY 521 Test & 3D Simulation RC Multi Channel Arduino Proportional Transmitter / Receiver with Button Trimmers 
Add instructable to: