Skip to content

Instantly share code, notes, and snippets.

@yoggy
Created December 7, 2010 06:11
Show Gist options
  • Save yoggy/731531 to your computer and use it in GitHub Desktop.
Save yoggy/731531 to your computer and use it in GitHub Desktop.
//
// Apple Remote IR Protocol test.pde
//
// Please install IRemote library.
// http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
//
// This sketch uses the PL-IRM0101.
// http://akizukidenshi.com/catalog/g/gI-00622/
//
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop() {
if (irrecv.decode(&results)) {
// for apple remote protocol
char val = (results.value >> 8) & 0xFF;
switch(val) {
case 0x20:
Serial.println("play");
break;
case 0x40:
// menu
Serial.println("menu");
break;
case 0x10:
Serial.println("rev");
break;
case 0xE0:
Serial.println("fwd");
break;
case 0xD0:
Serial.println("plus");
break;
case 0xB0:
Serial.println("minus");
break;
case 0xFF:
Serial.println("repeat code");
break;
default:
break;
}
irrecv.resume();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment