Controlled Disco Light

SRJT09201

Jugaadu and his friend Bhuvnesh are planning to make a Disco room in his house. Bhuvnesh is a DJ-disc jockey and plays recorded popular music on the radio and at a club or party. He is very good at music but he needs some help with dazzling light effects. He wants the lights to be set up in a way that he can operate and control it by himself. They are inviting us too. So, let us help them?

Bag Items:

  1. Joystick
  2. 5 RGB LEDs
  3. Breadboard
  4. Arduino UNO UNO
  5. Jumper Cables
  6. USB cable
  7. Battery and DC Jack
  8. Foam sheets
  9. Paper
  10. Glue gun
  11. Tape
  12. Cutter
We can make a joystick-controlled light. Since the DJ needs to move his hands constantly so that he can easily change lights. We can also map the value of joystick to value of LEDs to make the disco light.

    int r=3;
int g=5;
int b=6;
int x=A0;
int y=A1;
int val;
int red;
int green;
int blue;
void setup() {
// put your setup code here, to run once:
pinMode(r,OUTPUT);
pinMode(g,OUTPUT);
pinMode(b,OUTPUT);
analogWrite(4,255);
}

void loop() {
// put your main code here, to run repeatedly:
red=map(analogRead(x),0,1023,0,255);
green=map(analogRead(y),0,1023,0,255);
val=analogRead(x)+analogRead(y);
blue=map(val,0,2046, 0,255);
analogWrite(r,red);
analogWrite(g,green);
analogWrite(b,blue);
}