Setting Infrared Value to variable to control servos

Hi Everyone,
I have been using the code below from Ken Shirriff’s blog for an infrared sensor and was hoping for some help in understanding the language. It works perfectly and prints out values to the serial monitor like “FFFFEEOFFF”. Assuming that is one of the values can you explain how to write a code so that when that value is read by the infrared sensor a servo motor starts. Thanks so much.

#include <IRremote.h>

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}

It works perfectly and prints out values to the serial monitor like “FFFFEEOFFF”.

If it really printed a value like that, it is not working perfectly.

This statement

    Serial.println(results.value, HEX);

says to print the value of the value member in the class instance called results, in hex format. The value member is an unsigned long, which is 4 bytes. So, the value printed would be a maximum of 8 characters.

Yours has 10.

Assuming that is one of the values can you explain how to write a code so that when that value is read by the infrared sensor a servo motor starts. Thanks so much.

Your going to kick yourself…

unsigned long someValue = 0xXXXXXXXX; // where XXXXXXXX is the actual value
// printed by the code you showed
if(results.value == someValue)
{
   // Do something...
}