#include <IRremote.h>
int sbp=6;
int yp=10;
int pp=5;
int is=9;
int sbb=255;
int yb=255;
int pb=255;
IRrecv IR(is);
int dt=500;
float df=1;
void setup()
{
pinMode(sbp, OUTPUT);
pinMode(yp, OUTPUT);
pinMode(pp, OUTPUT);
Serial.begin(9600);
IR.enableIRIn(); // Start the receiver
}
void loop()
{
/*
Press Button on IR Remote Colour of LED Glow
pwr White
Menu LED is OFF
0 Mix colour
1 Red
2 Green
3 Blue
4 Cyan
5 Yellow
6 Majanta
Minus To dim Glow of LED
plus To inc. Glow of LED
*/
//RED=PURPLE+YELLOW
//BLUE=SKY BLUE+PURPLE
//GREEN=SKY BLUE+YELLOW
// Checks received an IR signal
while (IR.decode()==0) {
}
Serial.println(IR.decodedIRData.command, HEX);
switch (IR.decodedIRData.command) {
case 162:
Serial.println("Button press is POWER");
break;
case 226:
Serial.println("Button press is MENU");
break;
case 34:
Serial.println("Button press is TEST");
break;
case 2:
Serial.println("Button press is PLUS");
break;
case 194:
Serial.println("Button press is BACK");;
break;
case 224:
Serial.println("Button press is PREVIOUS");
break;
case 168:
Serial.println("Button press is PLAY");
break;
case 144:
Serial.println("Button press is NEXT");
break;
case 104:
Serial.println("Button press is NUM: 0");
break;
case 152:
Serial.println("Button press is MINUS");
break;
case 176:
Serial.println("Button press is KEY: C");
break;
case 48:
Serial.println("Button press is NUM: 1");
break;
case 24:
Serial.println("Button press is NUM: 2");
break;
case 122:
Serial.println("Button press is NUM: 3");
break;
case 16:
Serial.println("Button press is NUM: 4");
break;
case 56:
Serial.println("Button press is NUM: 5");
break;
case 90:
Serial.println("Button press is NUM: 6");
break;
case 66:
Serial.println("Button press is NUM: 7");
break;
case 74:
Serial.println("Button press is NUM: 8");
break;
case 82:
Serial.println("Button press is NUM: 9");
break;
default:
Serial.println("Do not press any button");
delay(dt);
}
if(IR.decodedIRData.command==162){
sbb=255;
yb=255;
pb=255;
df=1;
}
if(IR.decodedIRData.command==226){
sbb=0;
yb=0;
pb=0;
df=0;
}
if(IR.decodedIRData.command==104){
sbb=128;
yb=128;
pb=128;
}
if(IR.decodedIRData.command==48){
sbb=0;
yb=255;
pb=255;
}
if(IR.decodedIRData.command==24){
sbb=255;
yb=255;
pb=0;
}
if(IR.decodedIRData.command==122){
sbb=255;
yb=0;
pb=255;
}
if(IR.decodedIRData.command==16){
sbb=255;
yb=0;
pb=0;
}
if(IR.decodedIRData.command==56){
sbb=0;
yb=255;
pb=0;
}
if(IR.decodedIRData.command==90){
sbb=0;
yb=0;
pb=255;
}
if(IR.decodedIRData.command==152){
df=df*.9;
}
if(IR.decodedIRData.command==2){
df=df*1.1;
if(df>1){
df=1;
}
}
analogWrite(sbp,sbb*df);
analogWrite(yp,yb*df);
analogWrite(pp,pb*df);
IR.resume();
}