0

I just bought VS1838B IR module (from here) and trying to work with it. I have connect 1838B receiver like this :

enter image description here

And this is my code (whole code here) :

#include <IRremote.h>

int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
#define CH1 0xFFA25D 
#define CH 0xFF629D
#define CH2 0xFFE21D
...
#define BUTON8 0xFF4AB5
#define BUTON9 0xFF52AD

void setup()

{

 Serial.begin(9600);

 irrecv.enableIRIn(); 

}

void loop() {


 if (irrecv.decode(&results)) 
  {

 if (results.value == CH1) 

 {

 Serial.println("CH-"); 
 }

 if (results.value == CH) 

 {

 Serial.println("CH"); 

 }

 if (results.value == CH2) 

 {

 Serial.println("CH+"); 

 }

 ...

 if (results.value == BUTON8) 

 {

 Serial.println("BUTON8"); 

 }
if (results.value == BUTON9) 

 {

 Serial.println("BUTON9"); 

 }
 irrecv.resume();

 }



}

But I'm not getting any output on serisal monitor. Can you help me for debugging it?

  • Are you sure you have a proper remote control? How did you get the constant values from? – jfpoilpret Aug 25 '14 at 20:30
  • 1
    You should add Serial.println(results.value); after if irrecv.decode(&results)) { to check what codes are really received from your remote. – jfpoilpret Aug 25 '14 at 20:35
  • @jfpoilpret It's not printing anything, it's not going inside of that if() . I'm use I'm using a proper controller because all they came together, as a kit. – Eray Aug 25 '14 at 21:42
3

Looking further here

http://forum.arduino.cc/index.php/topic,188236.0.h...

I found the following

"Removing the files - libraries\RobotIRremote\IRremoteTools.cpp and libraries\RobotIRremote\IRremoteTools.h solved the problem. They are example files which somehow are getting included. You can move those two files to some other location as backup."

I went to my libraries file and did this and can confirm that the example given above then compiles fine without downloading a new library. Its an Arduino libraries problem .

Either way will work

answer from here and worked for me

i use this code:

#include <IRremote.h>
int input_pin = 10; //set D10 as input signal pin
IRrecv irrecv(input_pin);
decode_results signals;
void setup()
{
    Serial.begin(9600);
    irrecv.enableIRIn(); // enable input from IR receiver
}
void loop() {
if (irrecv.decode(&signals)) {
        Serial.println(signals.value, HEX);
        irrecv.resume(); // get the next signal
    }
}
| improve this answer | |
  • Yup, this was my issue as well. On macOS the files are stored in the contents of Arduino.app, so using Finder you need to go to /Applications, then right-click Arduino.app and click "Show Package Contents". Now, navigate to the folder /Applications/Arduino.app/Contents/Java/libraries and delete the folder "RobotIRremote". You can also do this easily from the Terminal using the rm -r /Applications/Arduino.app/Contents/Java/libraries/RobotIRremote command. – cody.codes Oct 5 '18 at 23:01
0

I could be wrong, but I believe that this receiver operates at 38kHz (at least that is listed in the specs), so the IR source must be oscillating at that frequency for this receiver to see it. Check out this link to see how to create a circuit to oscillate your IR LED:

http://www.electro-tech-online.com/threads/ir-emitter-at-38khz.94119/

| improve this answer | |
  • Whilst you link may answer the question, it would be preferable to include the essential parts of the linked here, and provide the link for citation. Thanks! – Anonymous Penguin May 3 '15 at 22:58
0

i have also bought this IR receiver with a remote controller (as a kit), and i had the same problem, i changed the remote controller and it worked perfectly, so even if the IR and RC came as a kit it doesn't mean they will work, if you don't have another remote controller in hand you can use a lighter just to check if the IR is working.

| improve this answer | |
0
void loop(void) {
   int numberpulses;

   numberpulses = listenForIR();

   Serial.print("Heard ");
   Serial.print(numberpulses);
   Serial.println("-pulse long IR signal");
   if (IRcompare(numberpulses, ApplePlaySignal)) {
      Serial.println("PLAY");
      if (ledState == LOW)
         ledState = HIGH;
      else
         ledState = LOW;

      // set the LED with the ledState of the variable:
      digitalWrite(ledPin, ledState); 

   }
   if (IRcompare(numberpulses, AppleRewindSignal)) {
      Serial.println("REWIND");
   }
   if (IRcompare(numberpulses, AppleForwardSignal)) {
      Serial.println("FORWARD");
   }
}
| improve this answer | |
0

connect vcc to 5V connect Gnd to GND connect In to D11 pin onto Uno, Nano etc. download the library from here and follow the instructions/where to unzip and removing the other folders/: http://z3t0.github.io/Arduino-IRremote/

Open the Arduino program and paste this code onto a new Arduino project:

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
  if (irrecv.decode(&results))
    {
     Serial.println(results.value, HEX);
     irrecv.resume(); // Receive the next value
    }
}

Select 'Sketch'/Import Library from Arduino and select IRremote from the drop-down menu.

Upload the sketch Open Tools/Serial monitor then select 9600 as baud rate Use a Tv remote, IR car remote or the remote from the module. You will see the HEX code of each button after pressing it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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