I'm completely new to using IR and I've followed the basic schematics and code, but when I run the code to detect the button codes, it returns 0 and an error (shown below) when I press a button on my remote. Below are the results in the Serial Monitor.
(I enabled the debug text in the .h file)
Space=300 is not 889 or 1778 Bose: Data length=50 is not 36
0
Space=250 is not 889 or 1778 Bose: Data length=10 is not 36
0
Space=300 is not 889 or 1778 Bose: Data length=56 is not 36
0
Space=250 is not 889 or 1778 Bose: Data length=60 is not 36
0
Space=250 is not 889 or 1778 Bose: Data length=58 is not 36
0
Space=250 is not 889 or 1778 Bose: Data length=52 is not 36
0
I'm using Arduino Nano, with an IR reciver on a little breakout board. I've tried several different remotes and all did the same thing.
This is using V3.0.0 of the IRRemote library by shirriff. I've used a previous version (2.8.1) of the library and had different results in the form of a 8-digit string of letters and numbers, but they were not consistant with each press of the same button. (different code was used with the previous version, but it was supposed to achieve the same thing)
What IR remote device are you using to test this with ? Please provide a link.
It is true that there have been recent and substantial changes to the IR library. Also state which Arduino you are using because not all are supported.
6v6gt:
What IR remote device are you using to test this with ? Please provide a link.
It is true that there have been recent and substantial changes to the IR library. Also state which Arduino you are using because not all are supported.
I've used multiple remots (hexbug battlebots, insignia, ge), and they all give the same kind of results. I'm using a Nano btw.
This is the reciever I'm using:
I just went through the same thing. Your frame buffer is too small.
I found different libraries.
/*
* IRremote: IRreceiveDump - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Initially coded 2009 Ken Shirriff http://www.righto.com
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
* LG added by Darryl Smith (based on the JVC protocol)
*/
#include <IRremote.h>
/*
* Default is Arduino pin D11.
* You can change this to another available Arduino Pin.
* Your IR receiver should be connected to the pin defined here
*/
#if defined(ESP32)
int IR_RECEIVE_PIN = 15;
#else
int IR_RECEIVE_PIN = 11;
#endif
IRrecv IrReceiver(IR_RECEIVE_PIN);
// On the Zero and others we switch explicitly to SerialUSB
#if defined(ARDUINO_ARCH_SAMD)
#define Serial SerialUSB
#endif
void setup() {
pinMode(2, OUTPUT);
Serial.begin(115200);
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL)
delay(2000); // To be able to connect Serial monitor after reset and before first printout
#endif
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__));
IrReceiver.enableIRIn(); // Start the receiver
IrReceiver.blink13(true); // Enable feedback LED
Serial.print(F("Ready to receive IR signals at pin "));
Serial.println(IR_RECEIVE_PIN);
}
void loop() {
if (IrReceiver.decode()) {
Serial.println();
IrReceiver.printIRResultRaw(&Serial);
IrReceiver.resume(); // Receive the next value
}
}
Also the debug messages in the OP imply that the library is expecting an NEC protocol or similar remote control device. A space of 250 or 300 uS is very short, but stranger is the inconsistent numbers of data bits.
I don’t understand your wiring description which may refer to the wire colours. The IR receiver device in the picture has a pin labeled ‘S’ which is the signal pin and this should go to pin 2 on the Arduino