Here's a piccy:
#include <IRremote.h>
int RECV_PIN = 2;
int Powerpin = 8;
int LEDreceivePin = 3; // Flash LED when IR signal received.
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(Powerpin, OUTPUT); // sets the digital pin as output
pinMode(LEDreceivePin, OUTPUT); // sets the digital pin as output
Serial.println("begin...");
}
void loop() {
if (irrecv.decode(&results)) {
long int decCode = results.value;
Serial.println(decCode);
digitalWrite(LEDreceivePin, HIGH);
delay(125);
digitalWrite(LEDreceivePin, LOW);
switch (results.value) {
case 2704:
Serial.println("POWER");
digitalWrite(Powerpin,HIGH);
delay(1000);
digitalWrite(Powerpin,LOW);
break;
case 428895:
Serial.println("Stop");
digitalWrite(Powerpin, LOW); // sets the LED off
break;
default:
Serial.println("Waiting ...");
}
irrecv.resume(); // Receive the next value
}
}
All stolen from here: http://arduinotronics.blogspot.it/2012/11/arduino-ir-receiver-part-2.html