Tinkers Projects

Imagine | Develop | Create

RGB LightMain
RGB Light0
RGB Light1
RGB Light2
RGB Light3
RGB Light4
RGB Light5
RGB Light6
RGB Light7
RGB Light8
A while ago, I got some Broken RGB party lights from Jaycar for very cheap. For a long time, they have been sitting on my window ledge waiting for me to install a new controller. when I was finishing a different project I saw it and knew that I needed to make a controller. The controller that I installed uses an LCD to control the lighting effects of fading and stepping between colours. It can also set solid colours and the speed of the effects between colors. I used the PLEX board to control the LEDs and the LCD with 3 buttons as the user interface. I created a library for Arduino to control the fading of the LEDs.

Code for Project

GNU General Public License v3.0
#include <LiquidCrystal.h>
#include <RGB_LED.h>
#define upButtonPin A0
#define downButtonPin A1
#define modeButtonPin A2

byte mode = 1;
unsigned int speed = 1000;
byte DMX = 1;

LiquidCrystal lcd(2, 4, 5, 6, 7, 8);
RGB_LED LED(3,10,11);

void setup() 
{
  Serial.begin(9600);
  lcd.begin(16, 2);
  pinMode(upButtonPin,INPUT);
  pinMode(downButtonPin,INPUT);
  pinMode(modeButtonPin, INPUT);
  Serial.println("Start");
  changemode();
  setsetting();
}

void loop() 
{
   LED.run();
  
   if(mode ==6)
   {
     DMXcontrol();
   }

   if(digitalRead(modeButtonPin)==HIGH)
   {
      mode++;
      changemode();
      setsetting();
      controldelay(); // and mode button is low
   }
   if(digitalRead(upButtonPin)==HIGH)
   {
      upsetting();
      setsetting();
      controldelay();
   }
   if(digitalRead(downButtonPin)==HIGH)
   {
      downsetting();
      setsetting();
      controldelay();
   }
}



void changemode()
{
  lcd.setCursor(0,0);
  Serial.println(mode);
  switch(mode)
  {
    case 1:
      Serial.println("Fade");
      lcd.print("Fade");
      LED.setFunction(Fade);
    break;
    case 2:
      Serial.println("Fade Random");
      lcd.print("Fade Random");
      LED.setFunction(FadeRandom);
    break;
    case 3:
      Serial.println("Step RGB");
      lcd.print("Step RGB");
      LED.setFunction(Step1);
    break;
    case 4:
      Serial.println("Step ALL");
      lcd.print("Step ALL");
      LED.setFunction(Step2);
    break;
    case 5:
      Serial.println("Step Random");
      lcd.print("Step Random");
      LED.setFunction(StepRandom);
    break;
    case 6:
      Serial.println("DMX");
      lcd.print("DMX");
      LED.fadeToColour(Black,500);
    break;
    case 7:
      Serial.println("White");
      lcd.print("White");
      LED.fadeToColour(White,500);
    break;
    case 8:
      Serial.println("Red");
      lcd.print("Red");
      LED.fadeToColour(Red,500);
    break;
    case 9:
      Serial.println("Gre");
      lcd.print("Green");
      LED.fadeToColour(Green,500);
    break;
    case 10:
      Serial.println("Blue");
      lcd.print("Blue");
      LED.fadeToColour(Blue,500);
    break;
    default:
      mode = 1;
      changemode();
  }
  lcd.print("                ");
}

void setsetting()
{
  lcd.setCursor(0,1);
  if(mode <=5)
  {
    lcd.print("Speed: ");
    lcd.print(speed);
    LED.setSpeed(speed);
  }
  else if(mode ==6)
  {
    lcd.print("Address: ");
    lcd.print(DMX);
  }
  lcd.print("                ");
}



void upsetting()
{
  if(mode <=5 && speed < 30000)
  {
    speed = speed +100;
  }
  else if(mode ==6 && DMX < 255)
  {
    DMX++;
  }
}


void downsetting()
{
  if(mode <=5 && speed > 100)
  {
    speed = speed - 100;
  }
  else if(mode ==6 && DMX > 1)
  {
    DMX--;
  }
}



void controldelay()
{
  unsigned long currenttime = millis();
  while(currenttime+50 > millis() || digitalRead(modeButtonPin)==HIGH)
  {
    LED.run();
  }
}





void DMXcontrol()
{
  
}
A while ago, I got some Broken RGB party lights from Jaycar for very cheap. For a long time, they have been sitting on my window ledge waiting for me to install a new controller. when I was finishing a different project I saw it and knew that I needed to make a controller. The controller that I installed uses an LCD to control the lighting effects of fading and stepping between colours. It can also set solid colours and the speed of the effects between colors. I used the PLEX board to control the LEDs and the LCD with 3 buttons as the user interface. I created a library for Arduino to control the fading of the LEDs.