Go Down

Topic: Can't get IRrecvDemo example to work as expected (Read 1 time) previous topic - next topic

luxxtek

I bought the DFRobot IR Remote controller kit and tried to use it with the IRrecvDemo.
Many applications can be found that are based on the IRrecvDemo, but none seem to work for me.
Without making changes to IRrecvDemo, I tried it with IDE 23 but my Serial.print always shows 8 character values rather than the 6 character values as illustrated below




I always get 8 digit hex codes like these:

25802501
CBD2CCFD
FFFFFFFF
57E346E1
D9EF995E
B1EFBA9D
B1EFBA9D
6E2B307C
6BFD8B01
1E29FBFF
925D5B5D
1E90961
FFFFFFFF

As a result the code cannot work

Code: [Select]

else if(results.value==0xFD906F)
{
motor(-40,-40);
}



I'm sure the hardware is OK, the sample code  found here http://www.dfrobot.com/wiki/index.php?title=IR_Kit%28SKU:DFR0107%29 works OK. Note that this sample code does not use the IRremote.h library.


Any help would be appreciated.

PaulS

Quote
As a result the code cannot work

You can specify any value that the device received as the value to match to:
Code: [Select]
if(results.value==0xD9EF995E)
{
   // Got D9EF995E...
}

JoeO


luxxtek



Code: [Select]
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/

#include <IRremote.h>

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
  }
}

PaulS

The code that tries to use the values that you have recorded, not the code that printed them.

Go Up