Problem with IR sensor (remote control readings)

I have an Arduino Uno and im trying to read the input from a IR remote(car mp3) through a vs1838 receiver, but when i open the serial monitor i only get 0's from all keys.
I tried different remotes, all with the same result. Is it possible that controller and receiver are incompatible?
This is the code:

#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn();
  irrecv.blink13(true);
}

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

Sorry for any mistakes, english is not my main language.

Confirm that the remote is actually sending. Most cell phone cameras are sensitive to IR. Point your remote at the camera and watch for the blue light flashing when you press buttons on the remote.

Do you know if the decoder frequency and the remote frequency match?

What version of the IRRemote library are you using? There are significant changes in the newer library. The latest version of the library is not compatible with old code. Use the examples from the new library.

If you are using the newest version of IRRemote library, try this example code:

#include <IRremote.h>

const byte IR_RECEIVE_PIN = 7;

void setup()
{
   Serial.begin(115200);
   Serial.println("IR receive test");
   IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);//pin 13 LED flashes with IR input
}

void loop()
{
   if (IrReceiver.decode())
   {
      unsigned long keycode = IrReceiver.decodedIRData.command;
      Serial.println(keycode, HEX);
      if ((IrReceiver.decodedIRData.flags & IRDATA_FLAGS_IS_REPEAT))  // ignore repeat code
      {
         IrReceiver.resume();
         return;
      }
      IrReceiver.resume();
   }
}

Thank you, groundFungus, that worked first try changing changing the bauds of the monitor.im gonna have to learn more about this librery and practice C++ because and dont fully understand that piece of code, but thanks again.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.