IR sensor problem - TSOP1838

I cant get my TSOP1838 IR sensor to work. It is not detecting any IR waves, It's not outputting anything in the Serial monitor

#include<IRremote.h>

  
  int recv_pin = 3;
  IRrecv receiver(recv_pin);
  decode_results results;
  
  void setup()
  {
     // put your setup code here, to run once:
     Serial.begin(9600);
     receiver.enableIRIn();
  }
  
  void loop()
  {
     // put your main code here, to run repeatedly:
     if (receiver.decode()) 
     {
        Serial.println(results.value, HEX);
        receiver.resume();
     }

}

I have tried from multiple remotes even making sure they are IR and not RF. I have also tried from my phone.

The problem is, it is not outputting anything in the Serial monitor. If I remove it from the breadboard while running without removing the wires and put it back, it'd continuously output a random hexadecimal without any buttons being pressed. I have also tried another arduino board(I have tried on arduino uno and arduino leonardo). I have also tried other cables. I have also tried another IR receiver. Keep in mind, today I bought the one I am using in the first picture. I had thought the other one was faulty, but apparently not.

I have checked the pins countless of times.

Thanks!

In your code, i miss something like receiver.begin()
see https://github.com/Arduino-IRremote/Arduino-IRremote

Check your wiring:

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