invalid suffix "BE3F" on integer constant

All, its been some years since I last used C++… :confused:

I’m want to trigger an action based on IR codes rxd and have put together the code below. Unfortunately whilst I compiled it last night ok, today it reports an error and i’m now not sure what ive done? I captured what I believe are the Hex codes from my IR remote - in this case button#1 is 9716BE3F.

The error when compiling reports;

sketch_IRreader_and_SDCard_may23a.ino:33:26: error: invalid suffix “BE3F” on integer constant
Multiple libraries were found for “IRremote.h”
Used: C:\Users\andy.upton\Documents\Arduino\libraries\Arduino-IRremote-master
Not used: C:\Program Files (x86)\Arduino\libraries\IRremote
Error compiling.

Note: The 1st and 5th lines above are in red font. I don’t believe the 2nd, 3rd and 4th lines above, in white font, are the issue at this time

The code I’ve produced is as follows;

// IRremote Libraries
#include <IRremote.h>
#include <IRremoteInt.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

// SD Card Libraries
#include <SPI.h>
#include <SD.h>                
#define SD_ChipSelectPin 4     // using digital pin 4 on arduino nano 328
#include <TMRpcm.h>            // also need to include this library...
TMRpcm tmrpcm;                 // create an object for use in this sketch
char mychar;

void setup() {
  // put your setup code here, to run once:
  irrecv.enableIRIn();                 // Start the receiver

  tmrpcm.speakerPin = 9;               //using pin 9 on Uno, Nano, etc
  if (!SD.begin(SD_ChipSelectPin)) {   // see if the card is present and can be initialized:
    Serial.println("SD fail");  
    return;                            // don't do anything more if not
   }"Start.wav");           //the sound file "Start" will play each time the arduino powers up, or is reset

void loop() {
  // put your main code here, to run repeatedly:
  if (irrecv.decode(&results))
     if(results.value == 9716BE3F)                 //check IR input for hex 9716BE3F  to start playback...
      {"Button1.wav");                 //Play Button1 sound 
   Serial.println(results.value, HEX);             //send the Hex over the serial monitor
   irrecv.resume();                                //Receive the next value

Hexadecimal literals require the 0x prefix.


unsigned long a = 0xDEADBEEF; //In hex - '0x' prefix
a = 3735928559; //In decimal - no prefix
a = 033653337357;//In octal - note the '0' prefix
a = 0b11011110101011011011111011101111; //In binary - the '0b' prefix

Also, the above really should have the suffix UL (or in lower case). This tells the compiler that the constants are the size of an unsigned long. Just L as a suffix means signed long. No suffix means the default size - i.e. int. Because on an Arduino an int is only 2 bytes, then in some calculations you risk the constants getting truncated. In your particular case and the examples above they shouldn't get truncated because they are being compared to (your case) or assigned to (my case) an unsigned long so it should know to treat them as such.

:) thank you Tom, so this should work then;

results.value == 0X9716BE3F


results.value == 0X9716BE3Ful

We usually use a lower case 'x' in 0x, but in practice it makes no difference.

Either of those lines should work, but the latter is preferred.