Remote control decoder

Does anybody has a working code for a Mega that works?
I don't know why every single code I found is giving me an error compalling. Just trying to make the tutorial but having problems to find the code that works.

Thanks

(deleted)

I made it work. Now the problem is the IF statement I'm usign and I don't know how to compare the numbers.

The 551505585 is the decimal value (20DF4EB1 in hex) I get when I push the red button on my remote but seems like I'm making a mistake. Not very familiar working with hex numbers and I dont understand very well how to operate with them.

#include <IRremote.h>
 
// Define sensor pin
const int RECV_PIN = 4;
 
// Define IR Receiver and Results Objects
IRrecv irrecv(RECV_PIN);
decode_results results;
 
 
void setup(){
  // Serial Monitor @ 9600 baud
  Serial.begin(9600);
  // Enable the IR Receiver
  irrecv.enableIRIn();
}
 
void loop(){
  if (irrecv.decode(&results)){
    // Print Code in HEX
        Serial.println(results.value, HEX);
       
        


//--------------------my code-------------------        
        Serial.println(results.value,DEC);
if (results.value,DEC == 551505585)  {
    Serial.println("red button");
  } else {
    Serial.println("no");
    }
//------------------------------------------------



  
        irrecv.resume();
  }
}

jucasan:

        Serial.println(results.value,DEC);

This causes the decimal (base 10) text representation of results.value to be sent over Serial. In fact, it's not necessary to specify DEC because the Print class defaults to decimal. You can specify HEX or BIN if you want it formatted otherwise.

jucasan:

if (results.value,DEC == 551505585)  {

It makes no sense to attempt to specify DEC here. The very form of 551505585 already tells the compiler it's in decimal form. If you write a number like 0x20DF4EB1, the compiler knows it's hex. If you write a number like 0b100000110111110100111010110001, the compiler knows it's binary.

pert:
This causes the decimal (base 10) text representation of results.value to be sent over Serial. In fact, it's not necessary to specify DEC because the Print class defaults to decimal. You can specify HEX or BIN if you want it formatted otherwise.
It makes no sense to attempt to specify DEC here. The very form of 551505585 already tells the compiler it's in decimal form. If you write a number like 0x20DF4EB1, the compiler knows it's hex. If you write a number like 0b100000110111110100111010110001, the compiler knows it's binary.

Thank you Pert. I'm making progress.

You're welcome. I'm glad if I've been of assistance.