1

I am trying to decode IR codes of my Samsung tv remote
But the receiver always receiving "0"

Schematics:

Schematics

Code:

#include <IRremote.h>      

int RECV_PIN = 11;        
IRrecv irrecv(RECV_PIN);
decode_results results;
 
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn();
}
 
void loop() 
{
  if (irrecv.decode(&results)) 
    {
    int value = results.value;
    Serial.println(" ");
    Serial.print("Code: ");
    Serial.println(results.value); 
    Serial.println(" ");
    irrecv.resume();              
    Serial.println("*****************");
    }
}

Please help me to decode my IR codes

1
  • 1
    The most current version of IRremote doesn't have any arguments for the decode function. To get the result you'd use irrecv.results to get the results.
    – Gerben
    Feb 10, 2021 at 13:56

1 Answer 1

1

Next update with 3.1 of the library, you need to call irrecv.decodedIRData.decodedRawData to get the data. This code worked for me:

#include <IRremote.h>

int IRpin = 11;
IRrecv irrecv(IRpin);

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

void loop() 
{
  if (irrecv.decode()) 
    {
      Serial.println(irrecv.decodedIRData.decodedRawData); // Print the Serial
      irrecv.resume();   // Receive the next value
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.