/* APPLE Universal Remote Control This sketch enables the Apple Remote to control anything you want. You need to put the values you want to change with the correct coding type for each button in the code. If you have to use RAW use the IRrecvDump sketch to get the raw data for the control you want, and then use the converter here: http://duinos.net/tools/irraw_convert.asp to quickly get the desired code to send. Made by Kristian BlÄsol 2015 youtube video: http://duinos.net */ #include int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; IRsend irsend; //for some reason always on pin 3? #define apple_middle 2011281997 //77E1BA4D #define apple_up 2011287629 //77E1D04D #define apple_left 2011238477 //77E1104D #define apple_down 2011279437 //77E1B04D #define apple_right 2011291725 //77E1E04D #define apple_menu 2011250765 //77E1404D #define apple_playpause 2011265613 //77E17A4D unsigned int progUp[77] = {4450,4450,500,450,500,500,500,500,500,500,500,450,500,1500,500,450,550,450,500,500,500,500,500,450,550,450,500,500,500,500,500,450,550,450,500,4400,500,1500,500,500,500,450,500,500,500,500,500,450,550,1450,500,1450,550,450,500,500,500,500,500,550,500,1450,500,1500,500,450,500,500,500,1500,500,1450,500,1500,500,1450,500}; unsigned int progDown[77] = {4450,4450,500,450,550,450,500,500,500,500,500,500,450,1500,500,500,500,450,500,500,500,500,500,450,550,450,500,500,500,500,500,450,500,500,500,4400,500,1500,500,450,500,500,500,500,500,1450,500,500,500,1500,500,1450,500,500,500,450,500,500,500,550,500,500,500,1450,550,450,500,500,500,1450,500,1500,500,1450,500,1450,500}; //volup=NEC, 20DF40BF //voldown=NEC, 20DFC03F //input=NEC, 20DFD02F //or: -11028 8850 -4400 600 -550 550 -550 600 -1600 600 -500 600 -550 550 -600 550 -550 550 -550 550 -1650 550 -1650 600 -550 550 -1650 600 -1600 600 -1650 550 -1650 550 -1650 600 -1650 550 -1650 600 -550 550 -1650 550 -550 600 -550 550 -550 550 -550 550 -600 550 -550 550 -1650 550 -550 600 -1600 600 -1650 550 -1650 600 -1600 600 void setup() { irrecv.enableIRIn(); // Start the receiver irrecv.blink13(1); } void loop() { if (irrecv.decode(&results)) { delay(200); //because the IR signals block each other. switch (results.value) { case apple_middle: //Do this when the middle button is pressed irsend.sendNEC(0x20DFD02F,32); irrecv.enableIRIn(); // because irsend disables irrecv break; case apple_up: //Do this when the up button is pressed irsend.sendNEC(0x20DF40BF,32); irrecv.enableIRIn(); // because irsend disables irrecv break; case apple_left: //Do this when the left button is pressed irsend.sendRaw(progDown,77,38); irrecv.enableIRIn(); // because irsend disables irrecv break; case apple_down: //Do this when the down button is pressed irsend.sendNEC(0x20DFC03F,32); irrecv.enableIRIn(); // because irsend disables irrecv break; case apple_right: //Do this when the right button is pressed irsend.sendRaw(progUp,77,38); irrecv.enableIRIn(); // because irsend disables irrecv break; case apple_menu: //Do this when the menu button is pressed //irsend.sendNEC(0x20DF40BF,32); //irrecv.enableIRIn(); // because irsend disables irrecv break; case apple_playpause: //Do this when the playpause button is pressed //irsend.sendNEC(0x20DF40BF,32); //irrecv.enableIRIn(); // because irsend disables irrecv break; } irrecv.resume(); // Receive the next value } }