#include <IRremote.h>
IRrecv receiver(2);
void setup() {
receiver.enableIRIn(); //ابدأ تشغيل جهاز الاستقبال
Serial.begin(9600);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
}
void loop() {
if (receiver.decode())
{
switch (receiver.decodedIRData.command) {
case 162:
digitalWrite(11,0);
digitalWrite(12,0);
Serial.println("POWER");
break;
case 226:
Serial.println("MENU");
break;
case 34:
Serial.println("TEST");
break;
case 2:
Serial.println("PLUS");
break;
case 194:
Serial.println("BACK");
break;
case 224:
Serial.println("PREV.");
break;
case 168:
Serial.println("PLAY");
break;
case 144:
Serial.println("NEXT");
break;
case 104:
Serial.println("num: 0");
digitalWrite(12,1);
break;
case 152:
Serial.println("MINUS");
break;
case 176:
Serial.println("key: C");
break;
case 48:
digitalWrite(12,0);
Serial.println("num: 1");
break;
case 24:
digitalWrite(10,1);
digitalWrite(9,1);
break;
case 122:
digitalWrite(11,1);
break;
case 16:
Serial.println("num: 4");
digitalWrite(10,0);
digitalWrite(9,0);
break;
case 56:
Serial.println("num: 5");
break;
case 90:
digitalWrite(11,0);
Serial.println("num: 6");
break;
case 66:
Serial.println("num: 7");
break;
case 74:
Serial.println("num: 8");
break;
default:
Serial.println("no have");
}
}
receiver.resume();// احصل على القيمة التالية
}