Go Down

Topic: Problem with IR Sensor (Read 111 times) previous topic - next topic


I am having a problem with the IR Sensor and remote. I haven't even gotten further in the project, I am just using the out of the box example with the IRRemote library from the starter kit. I've hooked up the IR Sensor, loaded the library, removed the RobotIRemote library to avoid conflict, and tested it. The serial monitor gives me only "Other button" for all button clicks. When I write results.value, HEX, then I get only 0. I have tried different remotes and I have bought a new IR sensor. Same result. always 0 in the Serial Monitor. I've switched pins, same result. Obviously something is getting communicated because it says 0 when I press a remote button. Any help would be appreciated.

I know the original pin was 11. You can see I switched the pin to 7 in the code just to see if that made a difference. It did not.
Code: [Select]


#include "IRremote.h"

int receiver = 7; // Signal Pin of IR receiver to Arduino Digital Pin 11

/*-----( Declare objects )-----*/
IRrecv irrecv(receiver);     // create instance of 'irrecv'
decode_results results;      // create instance of 'decode_results'

/*-----( Function )-----*/
void translateIR() // takes action based on IR code received

// describing Remote IR codes 


  case 0xFFA25D: Serial.println("POWER"); break;
  case 0xFFE21D: Serial.println("FUNC/STOP"); break;
  case 0xFF629D: Serial.println("VOL+"); break;
  case 0xFF22DD: Serial.println("FAST BACK");    break;
  case 0xFF02FD: Serial.println("PAUSE");    break;
  case 0xFFC23D: Serial.println("FAST FORWARD");   break;
  case 0xFFE01F: Serial.println("DOWN");    break;
  case 0xFFA857: Serial.println("VOL-");    break;
  case 0xFF906F: Serial.println("UP");    break;
  case 0xFF9867: Serial.println("EQ");    break;
  case 0xFFB04F: Serial.println("ST/REPT");    break;
  case 0xFF6897: Serial.println("0");    break;
  case 0xFF30CF: Serial.println("1");    break;
  case 0xFF18E7: Serial.println("2");    break;
  case 0xFF7A85: Serial.println("3");    break;
  case 0xFF10EF: Serial.println("4");    break;
  case 0xFF38C7: Serial.println("5");    break;
  case 0xFF5AA5: Serial.println("6");    break;
  case 0xFF42BD: Serial.println("7");    break;
  case 0xFF4AB5: Serial.println("8");    break;
  case 0xFF52AD: Serial.println("9");    break;
  case 0xFFFFFFFF: Serial.println(" REPEAT");break;  
  case 0: Serial.println(" GUESS WHAT");break;
    Serial.println(" other button   ");

  }// End Case

  delay(500); // Do not get immediate repeat

} //END translateIR
void setup()   /*----( SETUP: RUNS ONCE )----*/
  Serial.println("IR Receiver Button Decode"); 
  irrecv.enableIRIn(); // Start the receiver

}/*--(end setup )---*/

void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/
  if (irrecv.decode(&results)) // have we received an IR signal?

    irrecv.resume(); // receive the next value
}/* --(end main loop )-- */


Hello !

Please send the link/picture of your IR boards (senders and receivers)

maybe your IR remote control HEX codes does not match with your defined HEX values in switch() case:
so you need to scan your remote control key for finding new HEX values !


Jan 25, 2021, 05:19 pm Last Edit: Jan 25, 2021, 05:25 pm by Martin-X Reason: Fixed link (I think)
If you're using the latest version of the library then you need to have a look at this:

Github IRremote

The way you use the library has changed !

Go Up