IR Code Compile Error

Hi,

I'm trying to run the Instructables Apple IR Code. I updated the IR Data code values to match my remote.

Code here:

#include <Arduino.h>
#include <IRremote.h>
#include <IRremoteInt.h>

int RECV_PIN = 11;  // IR Receiver pin
int ledPin = 13;  // On board LED
int ledExPin = 10;  // External 5mm White LED

int delay0 = 60;  // LED visible time
int delay1 = 200; // 'Blink' interval
int delay2 = 25;  // 'Strobe' interval

IRrecv irrecv(RECV_PIN);
decode_results results;

// Create values for 'storing' states
int centreButtonState = 0;  // counts how many times centre 'Play/Pause' has been pressed
int brightness = 100; // stores brightness level
int mode = 0;  // stores activity modes

// Setup & Configuration 
void setup()
{ 
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  
  irrecv.enableIRIn(); // Start the receiver

  pinMode(ledPin, OUTPUT);  // define ledPin as an output
  pinMode(ledExPin, OUTPUT);

  analogWrite(ledExPin, brightness);  // LED PWM's at brightness value
}

/// M O D E S ///
void slowBlink()  {
  analogWrite(ledExPin, brightness);
  delay(delay1);
  analogWrite(ledExPin, 0);
  delay(delay1);
}

void strobe()  {
  analogWrite(ledExPin, brightness);
  delay(delay0);
  analogWrite(ledExPin, 0);
  delay(delay2);
}

void fade()  {
  for(int fadeValue = 0 ; fadeValue <= brightness; fadeValue +=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
  for(int fadeValue = brightness ; fadeValue >= 0; fadeValue -=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
}

void hypermixFade()  {
  for(int fadeValue = 0 ; fadeValue <= brightness; fadeValue +=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
  for(int x = 0; x < 6; x++)  {  // repeat 'slowBlink' 5x
    slowBlink();  
  }
  for(int x = 0; x < 6; x++)  {  // repeat 'strobe' 5x
    strobe();  
  }
  for(int fadeValue = brightness ; fadeValue >= 0; fadeValue -=5)  {
    analogWrite(ledExPin, fadeValue);  // fade out
    delay(30);
  }
}

// Main Loop 
void loop() {

  if (irrecv.decode(&results)) {  // if an IR signal is obtained from IR receiver

// When Centre button is pressed
    if(results.value == 77E1BA8B) {
      if(centreButtonState == LOW) {  // if previously LOW
        centreButtonState = HIGH;  // now make HIGH
        Serial.println("ACTIVE");
      }

      else  {  // if already HIGH
        centreButtonState = LOW;    // now make LOW
        Serial.println("STANDBY");  
      }
    }

// When '+' volume button pressed  
    if(results.value == 77E1D08B && brightness < 240)  { // if '+' volume button pressed
      brightness = brightness +20;  // add +20 to brightness val
      Serial.print("Brightness increased to ");
      Serial.println(brightness);  // print the new value
    } 

// When '-' volume button pressed   
    if(results.value == 77E1B08B && brightness > 0)  {  // if '-' volume button pressed and brightness isn't less than 0
      brightness = brightness -20;  // subtract -20 from brightness val
      Serial.print("Brightness decreased to ");
      Serial.println(brightness);  // print the new value
    }  

// When previous '<<' button pressed
    if(results.value == 77E1108B)  {
      if(mode > 0)  {
        mode = mode -1;  
      }
      else  {
        mode = 4;  
      }
      Serial.print("Mode: ");
      Serial.println(mode);  
    }

// When next '>>' button pressed
    if(results.value == 77E1E08B)  {
      if(mode < 4)  {
        mode = mode +1;  
      }
      else  {
        mode = 0;  
      }
      Serial.print("Mode: ");
      Serial.println(mode);  
    } 

// When 'menu' button pressed, RESET ALL VALUES TO DEFAULT
    if(results.value == 77E1408B)  {
      centreButtonState = HIGH;
      brightness = 100;
      mode = 0;
      Serial.println("RESET");  
    }

    irrecv.resume(); // Receive the next value  
  }

  switch (mode)  {  // Mode Management
  case 0:
    //   Serial.println("Constant");
    if(centreButtonState == HIGH)  {
      analogWrite(ledExPin, brightness);  
    }
    else  {
      analogWrite(ledExPin, 0);  
    }
    break;

  case 1:
    //   Serial.println("Slow Blink");
    if(centreButtonState == HIGH)  {
      slowBlink();  
    }
    break;

  case 2:
    //   Serial.println("Strobe");
    if(centreButtonState == HIGH)  {
      strobe();  
    }
    break;

  case 3:
    //   Serial.println("Fade");
    if(centreButtonState == HIGH)  {
      fade();  
    }
    break;

  case 4:
    //   Serial.println("HypermixFade");
    if(centreButtonState == HIGH)  {
      hypermixFade();  
    }
    break;
  }
}

I get this compile error message:

ARC_Proto1.cpp:124:25: error: invalid suffix "BA8B" on floating constant
ARC_Proto1.cpp:137:25: error: invalid suffix "D08B" on floating constant
ARC_Proto1.cpp:144:25: error: invalid suffix "B08B" on floating constant
ARC_Proto1.cpp:151:25: error: invalid suffix "B" on floating constant
ARC_Proto1.cpp:163:25: error: invalid suffix "E08B" on floating constant
ARC_Proto1.cpp:175:25: error: invalid suffix "B" on floating constant

It looks like the Apple Remote Code I entered:

77E1BA8B,etc...

I don't know how to fix this.

Thanks

  if(results.value == 77E1BA8B)  //this is not what you think it is... 

maybe this works best? 

  if(results.value == 0x77E1BA8B)
    if(results.value == 77E1BA8B) {

It might look like the Apple code to you, but the compiler is seeing the floating point constant 77E1 (or 77 x 101), followed by BA8B, which it doesn't know what to do with.

If that is meant to be a hex constant, then it should be prefixed with 0x.

    if(results.value == 0x77E1BA8B) {

Hi,

I tried in hex as suggested, 0x_______

but get this error

ARC_Instructables:106: error: integer constant is too large for 'long' type
ARC_Instructables:119: error: integer constant is too large for 'long' type

I used the IRrecvDemo sketch from here:

It outputs this when I press of the remote key, in this case:

77E1D08B
Decoded NEC: 77E1D08B (32 bits)
Raw (68): 19474 9000 -4450 550 -550 550 -1650 550 -1650 550 -1650 550 -600 550 -1600 600 -1650 550 -1650 550 -1650 550 -1650 550 -1650 550 -600 500 -600 550 -550 550 -550 550 -1650 550 -1650 550 -1650 550 -600 550 -1600 600 -550 550 -550 550 -600 550 -550 550 -1600 600 -550 550 -550 550 -600 550 -1600 550 -600 550 -1650 550 -1650 550

I'm thinking the #include <IRremote.h> & #include <IRremoteInt.h>

would see the 77E1D08B as a remote code but it's not.

How is the instructables code working then?

Lynxo:
Hi,

I tried in hex as suggested, 0x_______

but get this error

ARC_Instructables:106: error: integer constant is too large for 'long' type

ARC_Instructables:119: error: integer constant is too large for 'long' type

Can't reproduce that, sorry:

long foo = 0x77E1BA8B;

void setup () 
{
  if (foo == 0x77E1BA8B) 
    ;
    
}
void loop () {}

Compile results:

Binary sketch size: 466 bytes (of a 32,256 byte maximum)

Perhaps if you posted your code?

Hi,

The original unmodified code here:

http://www.instructables.com/id/Control-Arduino-with-IR-Apple-Remote/

/* ------------------------------------------------------------
 This sketch decodes IR signals sent to Arduino in response to
 buttons pressed on an Apple Remote controlling ouput of an LED
 attached to pin 10.
 
 o Play/Pause switches LED On / Standby
 o Brightness control '+' and '-' buttons
 o Modes '<<' and '>>' buttons
 o 'Menu' RESETS all values to default (brightness, constant on)
 
 MODES:
 0 - Constant On
 1 - Blink
 2 - Strobe
 3 - Fade in/out
 4 - Hypermixfade
 
 Author: A.dlP 
 Library: IRremote by Ken Sherriff
 Date Modified: 28th October 2010
 For: 'Control Arduino with IR Apple Remote' instructable. 
 URL: http://www.instructables.com
 -------------------------------------------------------------- */

#include <IRremote.h>
#include <IRremoteInt.h>

int RECV_PIN = 9;  // IR Receiver pin
int ledPin = 13;  // On board LED
int ledExPin = 10;  // External 5mm White LED

int delay0 = 60;  // LED visible time
int delay1 = 200; // 'Blink' interval
int delay2 = 25;  // 'Strobe' interval

IRrecv irrecv(RECV_PIN);
decode_results results;

// Create values for 'storing' states
int centreButtonState = 0;  // counts how many times centre 'Play/Pause' has been pressed
int brightness = 100; // stores brightness level
int mode = 0;  // stores activity modes

// Setup & Configuration 
void setup()
{ 
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  
  irrecv.enableIRIn(); // Start the receiver

  pinMode(ledPin, OUTPUT);  // define ledPin as an output
  pinMode(ledExPin, OUTPUT);

  analogWrite(ledExPin, brightness);  // LED PWM's at brightness value
}

/// M O D E S ///
void slowBlink()  {
  analogWrite(ledExPin, brightness);
  delay(delay1);
  analogWrite(ledExPin, 0);
  delay(delay1);
}

void strobe()  {
  analogWrite(ledExPin, brightness);
  delay(delay0);
  analogWrite(ledExPin, 0);
  delay(delay2);
}

void fade()  {
  for(int fadeValue = 0 ; fadeValue <= brightness; fadeValue +=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
  for(int fadeValue = brightness ; fadeValue >= 0; fadeValue -=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
}

void hypermixFade()  {
  for(int fadeValue = 0 ; fadeValue <= brightness; fadeValue +=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
  for(int x = 0; x < 6; x++)  {  // repeat 'slowBlink' 5x
    slowBlink();  
  }
  for(int x = 0; x < 6; x++)  {  // repeat 'strobe' 5x
    strobe();  
  }
  for(int fadeValue = brightness ; fadeValue >= 0; fadeValue -=5)  {
    analogWrite(ledExPin, fadeValue);  // fade out
    delay(30);
  }
}

// Main Loop 
void loop() {

  if (irrecv.decode(&results)) {  // if an IR signal is obtained from IR receiver

// When Centre button is pressed
    if(results.value == 2011242643) {
      if(centreButtonState == LOW) {  // if previously LOW
        centreButtonState = HIGH;  // now make HIGH
        Serial.println("ACTIVE");
      }

      else  {  // if already HIGH
        centreButtonState = LOW;    // now make LOW
        Serial.println("STANDBY");  
      }
    }

// When '+' volume button pressed  
    if(results.value == 2011287699 && brightness < 240)  { // if '+' volume button pressed
      brightness = brightness +20;  // add +20 to brightness val
      Serial.print("Brightness increased to ");
      Serial.println(brightness);  // print the new value
    } 

// When '-' volume button pressed   
    if(results.value == 2011279507 && brightness > 0)  {  // if '-' volume button pressed and brightness isn't less than 0
      brightness = brightness -20;  // subtract -20 from brightness val
      Serial.print("Brightness decreased to ");
      Serial.println(brightness);  // print the new value
    }  

// When previous '<<' button pressed
    if(results.value == 2011238547)  {
      if(mode > 0)  {
        mode = mode -1;  
      }
      else  {
        mode = 4;  
      }
      Serial.print("Mode: ");
      Serial.println(mode);  
    }

// When next '>>' button pressed
    if(results.value == 2011291795)  {
      if(mode < 4)  {
        mode = mode +1;  
      }
      else  {
        mode = 0;  
      }
      Serial.print("Mode: ");
      Serial.println(mode);  
    } 

// When 'menu' button pressed, RESET ALL VALUES TO DEFAULT
    if(results.value == 2011250835)  {
      centreButtonState = HIGH;
      brightness = 100;
      mode = 0;
      Serial.println("RESET");  
    }

    irrecv.resume(); // Receive the next value  
  }

  switch (mode)  {  // Mode Management
  case 0:
    //   Serial.println("Constant");
    if(centreButtonState == HIGH)  {
      analogWrite(ledExPin, brightness);  
    }
    else  {
      analogWrite(ledExPin, 0);  
    }
    break;

  case 1:
    //   Serial.println("Slow Blink");
    if(centreButtonState == HIGH)  {
      slowBlink();  
    }
    break;

  case 2:
    //   Serial.println("Strobe");
    if(centreButtonState == HIGH)  {
      strobe();  
    }
    break;

  case 3:
    //   Serial.println("Fade");
    if(centreButtonState == HIGH)  {
      fade();  
    }
    break;

  case 4:
    //   Serial.println("HypermixFade");
    if(centreButtonState == HIGH)  {
      hypermixFade();  
    }
    break;
  }
}

Lynxo:
Hi,

I tried in hex as suggested, 0x_______

but get this error

ARC_Instructables:106: error: integer constant is too large for 'long' type

ARC_Instructables:119: error: integer constant is too large for 'long' type

...

Perhaps if you posted your code?

(posts code)

Your posted code does not contain 0x_________

I meant, post your code, that has the suggested fix, that produces the reported error.

Hi,

Here is the code with the 0x____ :

/* ------------------------------------------------------------
 This sketch decodes IR signals sent to Arduino in response to
 buttons pressed on an Apple Remote controlling ouput of an LED
 attached to pin 10.
 
 o Play/Pause switches LED On / Standby
 o Brightness control '+' and '-' buttons
 o Modes '<<' and '>>' buttons
 o 'Menu' RESETS all values to default (brightness, constant on)
 
 MODES:
 0 - Constant On
 1 - Blink
 2 - Strobe
 3 - Fade in/out
 4 - Hypermixfade
 
 Author: A.dlP 
 Library: IRremote by Ken Sherriff
 Date Modified: 28th October 2010
 For: 'Control Arduino with IR Apple Remote' instructable. 
 URL: http://www.instructables.com
 -------------------------------------------------------------- */

#include <IRremote.h>
//#include <IRremoteInt.h>

int RECV_PIN = 9;  // IR Receiver pin
int ledPin = 13;  // On board LED
int ledExPin = 10;  // External 5mm White LED

int delay0 = 60;  // LED visible time
int delay1 = 200; // 'Blink' interval
int delay2 = 25;  // 'Strobe' interval

IRrecv irrecv(RECV_PIN);
decode_results results;

// Create values for 'storing' states
int centreButtonState = 0;  // counts how many times centre 'Play/Pause' has been pressed
int brightness = 100; // stores brightness level
int mode = 0;  // stores activity modes

// Setup & Configuration 
void setup()
{ 
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  
  irrecv.enableIRIn(); // Start the receiver

  pinMode(ledPin, OUTPUT);  // define ledPin as an output
  pinMode(ledExPin, OUTPUT);

  analogWrite(ledExPin, brightness);  // LED PWM's at brightness value
}

/// M O D E S ///
void slowBlink()  {
  analogWrite(ledExPin, brightness);
  delay(delay1);
  analogWrite(ledExPin, 0);
  delay(delay1);
}

void strobe()  {
  analogWrite(ledExPin, brightness);
  delay(delay0);
  analogWrite(ledExPin, 0);
  delay(delay2);
}

void fade()  {
  for(int fadeValue = 0 ; fadeValue <= brightness; fadeValue +=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
  for(int fadeValue = brightness ; fadeValue >= 0; fadeValue -=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
}

void hypermixFade()  {
  for(int fadeValue = 0 ; fadeValue <= brightness; fadeValue +=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
  for(int x = 0; x < 6; x++)  {  // repeat 'slowBlink' 5x
    slowBlink();  
  }
  for(int x = 0; x < 6; x++)  {  // repeat 'strobe' 5x
    strobe();  
  }
  for(int fadeValue = brightness ; fadeValue >= 0; fadeValue -=5)  {
    analogWrite(ledExPin, fadeValue);  // fade out
    delay(30);
  }
}

// Main Loop 
void loop() {

  if (irrecv.decode(&results)) {  // if an IR signal is obtained from IR receiver

// When Centre button is pressed
    if(results.value == 0x2011242643) {
      if(centreButtonState == LOW) {  // if previously LOW
        centreButtonState = HIGH;  // now make HIGH
        Serial.println("ACTIVE");
      }

      else  {  // if already HIGH
        centreButtonState = LOW;    // now make LOW
        Serial.println("STANDBY");  
      }
    }

// When '+' volume button pressed  
    if(results.value == 0x2011287699 && brightness < 240)  { // if '+' volume button pressed
      brightness = brightness +20;  // add +20 to brightness val
      Serial.print("Brightness increased to ");
      Serial.println(brightness);  // print the new value
    } 

// When '-' volume button pressed   
    if(results.value == 0x2011279507 && brightness > 0)  {  // if '-' volume button pressed and brightness isn't less than 0
      brightness = brightness -20;  // subtract -20 from brightness val
      Serial.print("Brightness decreased to ");
      Serial.println(brightness);  // print the new value
    }  

// When previous '<<' button pressed
    if(results.value == 0x2011238547)  {
      if(mode > 0)  {
        mode = mode -1;  
      }
      else  {
        mode = 4;  
      }
      Serial.print("Mode: ");
      Serial.println(mode);  
    }

// When next '>>' button pressed
    if(results.value == 0x2011291795)  {
      if(mode < 4)  {
        mode = mode +1;  
      }
      else  {
        mode = 0;  
      }
      Serial.print("Mode: ");
      Serial.println(mode);  
    } 

// When 'menu' button pressed, RESET ALL VALUES TO DEFAULT
    if(results.value == 0x2011250835)  {
      centreButtonState = HIGH;
      brightness = 100;
      mode = 0;
      Serial.println("RESET");  
    }

    irrecv.resume(); // Receive the next value  
  }

  switch (mode)  {  // Mode Management
  case 0:
    //   Serial.println("Constant");
    if(centreButtonState == HIGH)  {
      analogWrite(ledExPin, brightness);  
    }
    else  {
      analogWrite(ledExPin, 0);  
    }
    break;

  case 1:
    //   Serial.println("Slow Blink");
    if(centreButtonState == HIGH)  {
      slowBlink();  
    }
    break;

  case 2:
    //   Serial.println("Strobe");
    if(centreButtonState == HIGH)  {
      strobe();  
    }
    break;

  case 3:
    //   Serial.println("Fade");
    if(centreButtonState == HIGH)  {
      fade();  
    }
    break;

  case 4:
    //   Serial.println("HypermixFade");
    if(centreButtonState == HIGH)  {
      hypermixFade();  
    }
    break;
  }
}

Compile Error for above sketch:

ARC_Instructables:106: error: integer constant is too large for 'long' type
ARC_Instructables:119: error: integer constant is too large for 'long' type
ARC_Instructables:126: error: integer constant is too large for 'long' type
ARC_Instructables:133: error: integer constant is too large for 'long' type
ARC_Instructables:145: error: integer constant is too large for 'long' type
ARC_Instructables:157: error: integer constant is too large for 'long' type

Thanks

Here is the IR Header file:

/*
 * IRremote
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.htm http://arcfn.com
 * Edited by Mitra to add new controller SANYO
 *
 * Interrupt code based on NECIRrcv by Joe Knapp
 * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
 * Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
 *
 * JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
 */

#include <Arduino.h>

#ifndef IRremote_h
#define IRremote_h

// The following are compile-time library options.
// If you change them, recompile the library.
// If DEBUG is defined, a lot of debugging output will be printed during decoding.
// TEST must be defined for the IRtest unittests to work.  It will make some
// methods virtual, which will be slightly slower, which is why it is optional.
// #define DEBUG
// #define TEST

// Results returned from the decoder
class decode_results {
public:
  int decode_type; // NEC, SONY, RC5, UNKNOWN
  unsigned int panasonicAddress; // This is only used for decoding Panasonic data
  unsigned long value; // Decoded value
  int bits; // Number of bits in decoded value
  volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks
  int rawlen; // Number of records in rawbuf.
};

// Values for decode_type
#define NEC 1
#define SONY 2
#define RC5 3
#define RC6 4
#define DISH 5
#define SHARP 6
#define PANASONIC 7
#define JVC 8
#define SANYO 9
#define MITSUBISHI 10
#define UNKNOWN -1

// Decoded value for NEC when a repeat code is received
#define REPEAT 0xffffffff

// main class for receiving IR
class IRrecv
{
public:
  IRrecv(int recvpin);
  void blink13(int blinkflag);
  int decode(decode_results *results);
  void enableIRIn();
  void resume();
private:
  // These are called by decode
  int getRClevel(decode_results *results, int *offset, int *used, int t1);
  long decodeNEC(decode_results *results);
  long decodeSony(decode_results *results);
  long decodeSanyo(decode_results *results);
  long decodeMitsubishi(decode_results *results);
  long decodeRC5(decode_results *results);
  long decodeRC6(decode_results *results);
  long decodePanasonic(decode_results *results);
  long decodeJVC(decode_results *results);
  long decodeHash(decode_results *results);
  int compare(unsigned int oldval, unsigned int newval);

} 
;

// Only used for testing; can remove virtual for shorter code
#ifdef TEST
#define VIRTUAL virtual
#else
#define VIRTUAL
#endif

class IRsend
{
public:
  IRsend() {}
  void sendNEC(unsigned long data, int nbits);
  void sendSony(unsigned long data, int nbits);
  // Neither Sanyo nor Mitsubishi send is implemented yet
  //  void sendSanyo(unsigned long data, int nbits);
  //  void sendMitsubishi(unsigned long data, int nbits);
  void sendRaw(unsigned int buf[], int len, int hz);
  void sendRC5(unsigned long data, int nbits);
  void sendRC6(unsigned long data, int nbits);
  void sendDISH(unsigned long data, int nbits);
  void sendSharp(unsigned long data, int nbits);
  void sendPanasonic(unsigned int address, unsigned long data);
  void sendJVC(unsigned long data, int nbits, int repeat); // *Note instead of sending the REPEAT constant if you want the JVC repeat signal sent, send the original code value and change the repeat argument from 0 to 1. JVC protocol repeats by skipping the header NOT by sending a separate code value like NEC does.
  // private:
  void enableIROut(int khz);
  VIRTUAL void mark(int usec);
  VIRTUAL void space(int usec);
}
;

// Some useful constants

#define USECPERTICK 50  // microseconds per clock interrupt tick
#define RAWBUF 100 // Length of raw duration buffer

// Marks tend to be 100us too long, and spaces 100us too short
// when received due to sensor lag.
#define MARK_EXCESS 100

#endif
    if(results.value == 0x2011242643) {

Well it is too long. A long is 4 bytes. 0x2011242643 is 20 11 24 26 43 - that is 5 bytes.

Look, you changed two things here. Either you stick to hex, like this:

0x77E12093

or you use decimal, like this:

2011242643

You don't convert 0x77E12093 from hex to decimal and then stick 0x in front of it.

bubulindo:

  if(results.value == 77E1BA8B)  //this is not what you think it is... 

maybe this works best?

if(results.value == 0x77E1BA8B)

bubulindo's suggestion was correct but you didn't do that did you? You had:

  if(results.value == 0x2011282059)

That wasn't what he said.

In the first set of code you posted the first error was with 77e1ba8b (comment above it was "center button pressed")

you needed to change this to 0x77e1ba8b a hex number. But you changed it to 2011242643.

Mark

ok, I see what you are saying. I'm compile this now:

/* ------------------------------------------------------------
 This sketch decodes IR signals sent to Arduino in response to
 buttons pressed on an Apple Remote controlling ouput of an LED
 attached to pin 10.
 
 o Play/Pause switches LED On / Standby
 o Brightness control '+' and '-' buttons
 o Modes '<<' and '>>' buttons
 o 'Menu' RESETS all values to default (brightness, constant on)
 
 MODES:
 0 - Constant On
 1 - Blink
 2 - Strobe
 3 - Fade in/out
 4 - Hypermixfade
 
 Author: A.dlP 
 Library: IRremote by Ken Sherriff
 Date Modified: 28th October 2010
 For: 'Control Arduino with IR Apple Remote' instructable. 
 URL: http://www.instructables.com
 -------------------------------------------------------------- */

#include <IRremote.h>
//#include <IRremoteInt.h>

int RECV_PIN = 11;  // IR Receiver pin
int ledPin = 13;  // On board LED
int ledExPin = 10;  // External 5mm White LED

int delay0 = 60;  // LED visible time
int delay1 = 200; // 'Blink' interval
int delay2 = 25;  // 'Strobe' interval

IRrecv irrecv(RECV_PIN);
decode_results results;

// Create values for 'storing' states
int centreButtonState = 0;  // counts how many times centre 'Play/Pause' has been pressed
int brightness = 100; // stores brightness level
int mode = 0;  // stores activity modes

// Setup & Configuration 
void setup()
{ 
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  
  irrecv.enableIRIn(); // Start the receiver

  pinMode(ledPin, OUTPUT);  // define ledPin as an output
  pinMode(ledExPin, OUTPUT);

  analogWrite(ledExPin, brightness);  // LED PWM's at brightness value
}

/// M O D E S ///
void slowBlink()  {
  analogWrite(ledExPin, brightness);
  delay(delay1);
  analogWrite(ledExPin, 0);
  delay(delay1);
}

void strobe()  {
  analogWrite(ledExPin, brightness);
  delay(delay0);
  analogWrite(ledExPin, 0);
  delay(delay2);
}

void fade()  {
  for(int fadeValue = 0 ; fadeValue <= brightness; fadeValue +=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
  for(int fadeValue = brightness ; fadeValue >= 0; fadeValue -=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
}

void hypermixFade()  {
  for(int fadeValue = 0 ; fadeValue <= brightness; fadeValue +=5)  {
    analogWrite(ledExPin, fadeValue);
    delay(30);
  }
  for(int x = 0; x < 6; x++)  {  // repeat 'slowBlink' 5x
    slowBlink();  
  }
  for(int x = 0; x < 6; x++)  {  // repeat 'strobe' 5x
    strobe();  
  }
  for(int fadeValue = brightness ; fadeValue >= 0; fadeValue -=5)  {
    analogWrite(ledExPin, fadeValue);  // fade out
    delay(30);
  }
}

// Main Loop 
void loop() {

  if (irrecv.decode(&results)) {  // if an IR signal is obtained from IR receiver

// When Centre button is pressed
    if(results.value == 0x77E1BA8B) {
      if(centreButtonState == LOW) {  // if previously LOW
        centreButtonState = HIGH;  // now make HIGH
        Serial.println("ACTIVE");
      }

      else  {  // if already HIGH
        centreButtonState = LOW;    // now make LOW
        Serial.println("STANDBY");  
      }
    }

// When '+' volume button pressed  
    if(results.value == 0x77E1D08B && brightness < 240)  { // if '+' volume button pressed
      brightness = brightness +20;  // add +20 to brightness val
      Serial.print("Brightness increased to ");
      Serial.println(brightness);  // print the new value
    } 

// When '-' volume button pressed   
    if(results.value == 0x77E1B08B && brightness > 0)  {  // if '-' volume button pressed and brightness isn't less than 0
      brightness = brightness -20;  // subtract -20 from brightness val
      Serial.print("Brightness decreased to ");
      Serial.println(brightness);  // print the new value
    }  

// When previous '<<' button pressed
    if(results.value == 0x77E1108B)  {
      if(mode > 0)  {
        mode = mode -1;  
      }
      else  {
        mode = 4;  
      }
      Serial.print("Mode: ");
      Serial.println(mode);  
    }

// When next '>>' button pressed
    if(results.value == 0x77E1E08B)  {
      if(mode < 4)  {
        mode = mode +1;  
      }
      else  {
        mode = 0;  
      }
      Serial.print("Mode: ");
      Serial.println(mode);  
    } 

// When 'menu' button pressed, RESET ALL VALUES TO DEFAULT
    if(results.value == 0x77E14088B)  {
      centreButtonState = HIGH;
      brightness = 100;
      mode = 0;
      Serial.println("RESET");  
    }

    irrecv.resume(); // Receive the next value  
  }

  switch (mode)  {  // Mode Management
  case 0:
    //   Serial.println("Constant");
    if(centreButtonState == HIGH)  {
      analogWrite(ledExPin, brightness);  
    }
    else  {
      analogWrite(ledExPin, 0);  
    }
    break;

  case 1:
    //   Serial.println("Slow Blink");
    if(centreButtonState == HIGH)  {
      slowBlink();  
    }
    break;

  case 2:
    //   Serial.println("Strobe");
    if(centreButtonState == HIGH)  {
      strobe();  
    }
    break;

  case 3:
    //   Serial.println("Fade");
    if(centreButtonState == HIGH)  {
      fade();  
    }
    break;

  case 4:
    //   Serial.println("HypermixFade");
    if(centreButtonState == HIGH)  {
      hypermixFade();  
    }
    break;
  }
}

and get this error:

ARC_Instructables:157: error: integer constant is too large for 'long' type

Maybe this might shed some light. This is the IR date dump after one of the remote keys is pressed:

Volume UP:
77E1D08B
Decoded NEC: 77E1D08B (32 bits)
Raw (68): 19474 9000 -4450 550 -550 550 -1650 550 -1650 550 -1650 550 -600 550 -1600 600 -1650 550 -1650 550 -1650 550 -1650 550 -1650 550 -600 500 -600 550 -550 550 -550 550 -1650 550 -1650 550 -1650 550 -600 550 -1600 600 -550 550 -550 550 -600 550 -550 550 -1600 600 -550 550 -550 550 -600 550 -1600 550 -600 550 -1650 550 -1650 550

Has anyone used this IR library before?

The IR Receiver Dump sketch is working, outputs to serial monitor:

77E1D08B
Decoded NEC: 77E1D08B (32 bits)

However, I don't know if this is a HEX number or not. Is it?

I also notice the end of NEC 32bit is 8B. I removed these and it seems to compile without errors.
However, nothing happens, when remote button is pressed.

Hi,

I converted those NEC 32 bit from HEX to Decimal.

I pasted my decimal equivalent codes into the sketch and it is working now.

Thanks