I need help. I've tried coding and testing but nothing works. I want to make it so when you press the POWER button then the RGB LED toggles on or off. If you press 0 then it turns on and the light is white. But no matter what I do the RGB LED doesn't turn on. Here is the code that goes inside the Arduino UNO:
`
// IR remote Library
#include <IRremote.h>
//----Variables-----\
int RedPin = 11;
int GreenPin = 9;
int BluePin = 10;
IRrecv irrecv(12); //Start the IR
decode_results results; //Start the IR
unsigned long key_value = 0;
//-----Start-Once-----\
void setup(){
Serial.begin(9600);
pinMode(BluePin, OUTPUT);
pinMode(RedPin, OUTPUT);
pinMode(GreenPin, OUTPUT);
irrecv.enableIRIn();
irrecv.blink13(true);
}
//-------Repeat-------\
void loop(){
TranslateIR();
}
//------RGB-Colour-----\
void RGBColours(int red, int green, int blue) {
analogWrite(red, red);
analogWrite(green, green);
analogWrite(blue, blue);
}
//-----Translate-IR----\
void TranslateIR() {
if (irrecv.decode(&results)){
if (results.value == 0XFFFFFFFF)
results.value = key_value;
switch(results.value) {
case 0xFD00FF: //power
Serial.println("POWER");
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
break;
case 0xFD807F: //vol+
Serial.println("VOL+");
break;
case 0xFD40BF: //func/stop
Serial.println("FUNC/STOP");
break;
case 0xFD20DF: //|<<
Serial.println("|<<");
break;
case 0xFDA05F: //>||
Serial.println(">||");
break ;
case 0xFD609F: //>>|
Serial.println(">>|");
break ;
case 0xFD10EF: //down arrow
Serial.println("DOWN ARROW");
break ;
case 0xFD906F: //vol-
Serial.println("VOL-");
break ;
case 0xFD50AF: //up arrow
Serial.println("UP ARROW");
break ;
case 0xFD30CF: //0
Serial.println("0");
break ;
case 0xFDB04F: //eq
Serial.println("EQ");
break ;
case 0xFD708F: //st/rept
Serial.println("ST/REPT");
break ;
case 0xFD08F7: //1
Serial.println("1");
break ;
case 0xFD8877: //2
Serial.println("2");
break ;
case 0xFD48B7: //3
Serial.println("3");
break ;
case 0xFD28D7: //4
Serial.println("4");
break ;
case 0xFDA857: //5
Serial.println("");
break ;
case 0xFD6897: //6
Serial.println("6");
break ;
case 0xFD18E7: //7
Serial.println("7");
break ;
case 0xFD9867: //8
Serial.println("8");
break ;
case 0xFD58A7: //9
Serial.println("9");
break ;
}
key_value = results.value;
irrecv.resume();
}
}
`
Here is the circuit:
I am using TinkerCAD to make these circuits.