Najad
Published © GPL3+

12v RGB LED with Arduino

Program a 12v RGB LED strip with Arduino and how to make different color combinations and fading animations.

BeginnerProtip57,022
12v RGB LED with Arduino

Things used in this project

Hardware components

UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1
Arduino Nano
×1
UTSOURCE TIP120
×1
12v RGB LED strip
×1
Resistor 1k ohm
Resistor 1k ohm
×3

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Breadboard, 270 Pin
Breadboard, 270 Pin
10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long

Story

Read more

Schematics

Circuit

Code

Color Changing Program

C/C++
//www.diyusthad.com
//www.youtube.com/c/diyusthad

#define red 9
#define green 10
#define blue 11
int t = 500;

void setup()
{

}

void loop()
{
  analogWrite(red, 255);
  delay(t);
  analogWrite(green, 255);
  delay(t);
  analogWrite(blue, 255);
  delay(t);
  analogWrite(red, 0);
  delay(t);
  analogWrite(green, 0);
  delay(t);
}

Fading Program

C/C++
//www.diyusthad.com
//www.youtube.com/c/diyusthad

#define red 9
#define green 10
#define blue 11
int brightness;
int fadeAmount = 5;

void setup()
{

}

void loop()
{

  analogWrite(red, brightness); //writing brightness value to red
  analogWrite(green, brightness); //writing brightness value to green

  brightness += fadeamount; //increasing brightness value by 5 in each loop

  if (brightness < 0 || brightness > 255 )
  {
    fadeAmount = -fadeAmount; //reversing the direction of fading when brightness reachs 0 or 255
  }
  delay(30); //delaying the speed of fading 
}

Credits

Najad

Najad

30 projects • 94 followers
Just crazy stuff​

Comments