cyborg5 / irlib2 Goto Github PK
View Code? Open in Web Editor NEWLibrary for receiving, decoding, and sending infrared signals using Arduino
License: GNU General Public License v3.0
Library for receiving, decoding, and sending infrared signals using Arduino
License: GNU General Public License v3.0
I have a Pro Micro with receiver on PIN 2 and sender on PIN 9. While I have no problem with receiving the codes, I cannot send anything - I need NECX and SAMSUNG36. The hardware is not a problem as it works with IRremote (but that one has no SAMSUNG36 support). Is anyone using Pro Micro? Maybe I am missing something? My code:
#include <IRLibSendBase.h>
#include <IRLib_P07_NECx.h>
#include <IRLib_P08_Samsung36.h>
#include <IRLibCombo.h>
IRsend mySender;
void setup() {
Serial.begin(9600);
delay(2000); while (!Serial); //delay for Leonardo
}
void loop() {
mySender.send(SAMSUNG36,0x7887,0x0cb0);
delay(500);
mySender.send(NECX,0xe0e0e01f,0);
Serial.println(F("Sent signal."));
delay(1000);
}
I'm opening this issue myself to highlight a known problem. I cannot get PWM output on Trinket M0 pin 3. It is connected to hardware pin PA07 which is identical to pin 9 on Arduino Zero, Arduino M0 Pro, and Adafruit Feather M0 boards all of which work. But for some reason PA07 on the Trinket M0 does not work. Similarly Trinket M0 pin 4 is connected to hardware pin PA06 which is identical to pin 8 on the Arduino Zero and Arduino M0 Pro and those work perfectly but not on the Trinket M0.
The Gemma M0 should support PWM on its pin 2 but I cannot get it to work. It's connected to hardware pin PA05 which I have not used elsewhere but the code should still work.
Anyone with suggestions your help is much appreciated. We went ahead and released the code because pin 0 works okay on both boards and 2 works okay on the Trinket M0.
Hi,
I'm just starting using IRLib2 and wan't to emulate a remote (like most of users i presume).
I managed to decode some ir signals from my remote (ONKYO TX-SR508) with the IRrecv class. Could not manage to get results with IRRecvPCI.
Here's the serial output :
Decoded NEC(1): Value:4B36D32C Adrs:0 (32 bits)
Raw samples(68): Gap:18474
Head: m8850 s4450
0:m550 s600 1:m500 s1700 2:m550 s550 3:m550 s550
4:m550 s1700 5:m550 s550 6:m550 s1650 7:m550 s1700
8:m500 s600 9:m550 s550 10:m550 s1650 11:m550 s1700
12:m550 s550 13:m550 s1650 14:m550 s1700 15:m500 s600
16:m550 s1650 17:m550 s1650 18:m550 s600 19:m550 s1650
20:m550 s550 21:m550 s550 22:m550 s1700 23:m550 s1650
24:m550 s550 25:m550 s550 26:m550 s1700 27:m550 s550
28:m550 s1650 29:m550 s1700 30:m550 s550 31:m550 s550
32:m550
Extent=67100
Mark min:500 max:550
Space min:550 max:1700
I tried then to emit this same code with the IRsendNEC but the device didn't respond.
I got a control LED on a receiver so i know some code is emitted. Seems to be the wrong format even if i filled the send function with the values obtained with the receiver.
IRsendNEC necSender;
necSender.send(0x4b36d32c, 32);
Any idea where i did wrong ?
Thx.
Boimb.
Do you have any plans for Arduino Due with Atmel SAM3X8E ARM Cortex-M3 CPU?
I tried the Ken Shirriff's library but failed to control AC of different brands - LLOYD, DAIKIN, CARRIER etc. I tried your library - the raw recv and raw send examples. In the raw recv the length goes up to 100 and I am still not able to control my Air conditioner. I think that the length needs to be increased as there is more data coming from the remote. Can you tell me where is the length defined.
Hi, nice library, receiving works great, but i just dont get it how to send raw data, im a little bit confused, need help, i tried multiple paste variations and still get an error.
I have this:
Ready to receive IR signals
Do a cut-and-paste of the following lines into the
designated location in rawSend.ino
uint16_t rawData[RAW_DATA_LEN]={
4400, 4450, 550, 1650, 550, 1650, 550, 1650,
500, 550, 550, 550, 500, 550, 550, 500,
550, 550, 500, 1700, 500, 1700, 500, 1650,
550, 550, 550, 500, 550, 500, 550, 550,
550, 500, 550, 550, 500, 1700, 500, 550,
500, 550, 550, 550, 500, 550, 550, 500,
550, 550, 500, 1700, 500, 550, 500, 1700,
500, 1700, 550, 1650, 500, 1700, 500, 1700,
500, 1700, 500, 1000};
Where and how much do i have to paste of this in here (whole method below).
void irTransmitter() {
if (bttnSTATE == HIGH) {
myRawSender.send(rawData,RAW_DATA_LEN,36);
Serial.println(F("Sent signal."));
}
}
could you do this specific example, how should the whole method look after pasting raw code?
There are a couple instances of dual-emitter LEDs. For example, 660nm (red) and 940nm (IR). The problem is that these come in 3-lead common-anode packages. So to turn the IR diode "on" requires setting the output pin "low", not "high". How difficult do you think it would be to make this change? I don't want to get 3/4 of the mods in only to discover that the remaining 20% of the changes are going to use the other 80% of the time. We have zero board space left, so the space savings from moving from two discrete 3mm emitters to one combined package actuallyf
thanks.
joe
I need the smallest footprint possible so I can fit this into a small machine. I do not need to read or send any known protocol. What I need to be able to do is send 16-bit data packets, with a checksum (CRC-16) in the last one. Somewhere between five and ten data packets, then an ACK/NAK to indicate if the checksum matched the data. The first 8 bits will indicate the total number of packets that will be sent. There will be two kinds of ACK packets, both of which are a single 16-bit packet. If the first byte of the packet is NAK, retransmission will have to take place. If the first byte is ACK, the message has been receied sucessfully. The sender is ultra-low-power. If the second byte is 0, the transmitter computer shuts down until its next scheduled event occurs. If the second byte is 1, the transmitter will listen for data to be sent, and process that data, and shut down until it is again needed. It normally wakes up every minute or two, reads some sensors, and if they suggest action is required, then a message is sent via IRLIB to a computer without a power budget. What do you suggest as the smallest-footprint approach?
I am attempting to send RCMM protocol IR codes and wrote a very simple test sketch. Weirdly the call to delayMicroseconds after each send does not work at all (no matter what value I attempt to delay, the 3 'sends' are always 17.4 microseconds apart, which I assume is the loop overhead.) I tested delayMicroseconds() with another sketch (not using the IRLib2) and it works fine on my UNO board.
/*
IRsendRCMM mySender; //declare a sender object
const uint8_t SEND_REPEATS = 3; // total number of times to send an IR message
const uint16_t SEND_DELAY = 90; // delay between repeats in microseconds (us)
const uint32_t CODE_IR = 0x23802603; //code for button '3'
/*********************************************************
*
void setup() {
Serial.begin(115200);
delay(2000); while (!Serial); //delay for Leonardo
Serial.println(F("Every time you press a key is a serial monitor we will send."));
}
void loop() {
if (Serial.read() != -1) {
//send a code every time a character is received from the
// serial port.
sendSkyNZ(CODE_IR);
Serial.println(F("Sent signal."));
}
}
I just started to play with the IRLib2.
I did an analyse on a Sony remote and decoded it successfully with analyze.ino
Decoded Sony(2): Value:A50 Adrs:0 (12 bits)
Re-sending the code with send.ino works perfectly, TV is responding as expected
mySender.send(SONY,0xa50, 12);
I did try a RAW sampling on the same command with rawRecv.ino, and I got
#define RAW_DATA_LEN 26
uint16_t rawData[RAW_DATA_LEN]={
2374, 622, 1170, 630, 574, 626, 1174, 622,
570, 626, 574, 626, 1178, 618, 574, 626,
1178, 618, 582, 618, 574, 626, 574, 622,
582, 1000};
When I try to re-send the captured data with rawSend the TV is not responding to the command.
The serial output tells that some data is send 2 times
Sent signal.
Sent signal.
by re-capturing the raw data sent I'm getting a longer sampling LEN=2x26=52, something different like
#define RAW_DATA_LEN 52
uint16_t rawData[RAW_DATA_LEN]={
2394, 598, 1174, 654, 598, 622, 1118, 654,
598, 650, 562, 630, 1206, 622, 570, 650,
1170, 630, 574, 646, 594, 626, 554, 638,
586, 1106, 2418, 630, 1142, 686, 586, 634,
1198, 630, 582, 638, 586, 634, 1198, 658,
562, 630, 1174, 654, 570, 650, 558, 634,
538, 654, 590, 1000};
I'm having a problem importing your library into my sketch.
I've downloaded a zip of the code and installed each folder individually as a library via the arduino IDE.
They are correctly (?) located in my sketchbook folder:
My code is minimalistic:
#include <IRLibAll.h>
void setup(){}
void loop(){}
Without the import, it compiles fine. With the import, it fails.
The error message is this:
In file included from /home/lhk/sketchbook/libraries/IRLib2/IRLibAll.h:22:0,
from sketch_mar04f.ino:1:
/home/lhk/sketchbook/libraries/IRLib2/IRLibDecodeBase.h:13:28: fatal error: IRLibProtocols.h: No such file or directory
compilation terminated.
Apparently, it can't import the IRLibProtocols.h file.
This is in fact not located in the IRLib2 folder, but in the IRLibProtocols.
How can I make the files see each other. I thought I had installed the libraries in the supposed way.
With the normal ir decode dumb.ino I just got 0 or 0xFFFFFFFF as value, but with hashDecode.ino I got 2 codes, when I pressed one button. First is the header, its constant, but the second code is depend on the button (function).
Serial monitor (power on button):
Unknown protocol. Hash value is: 0x811C9DC5
Unknownprotocol. Hash value is: 0x39FCE14C
The problem is I can't replay this codes...
So, I got an arduino mega2560 (overkill, I know) set up to listen...
#include "IRLibAll.h"
IRrecvPCI myReceiver(2);
IRdecode myDecoder;
void setup() {
Serial.begin(115200);
delay(2000); while (!Serial);
myReceiver.enableIRIn();
Serial.println(F("Ready to receive IR signals"));
}
void loop() {
if(myReceiver.getResults()){
myDecoder.decode();
myDecoder.dumpResults(false);
myReceiver.enableIRIn();
}
}
Got a 1838 module, the result is:
Decoded NEC(1): Value:55AA25DA Adrs:0 (32 bits)
Then I set up an arduino uno set up to send...
#include <IRLibSendBase.h>
#include <IRLib_P01_NEC.h>
#include <IRLibCombo.h>
// tried #include "IRLibAll.h"
IRsend mySender;
void setup() {
Serial.begin(115200);
delay(2000); while (!Serial);
Serial.println(F("Ready to send IR signals."));
}
void loop() {
mySender.send(NEC, 0x55aa25da, 0); # tried 32 bits too :/
}
I have a normal small white led set up like this:
The reason I moved to a normal led is to try and see what I'm doing wrong when I tried with an IR led that wasn't working and I thought I got it burned. Later tests with a camera and + resistor / - test showed up the led working just fine. So I must be using the library wrong.
The final idea is to get rid of the bloat "peal" software on my samsung and write my own widget to send via Wifi ( ESP8266 maybe ? ) to an arduino micro to send the IR. I don't think I need a logitech remote. Also, the "peal" bloat is full of bugs and doesn't support ( even after I tried to talk to those guys and give them the info ) a small iogear wireless 5x2 matrix remote.
So, I have 2 questions:
If I get it working, I suppose I could use the ir led with a C1815 ?
Sorry for the long issue.
Hello
I am having problems with false posetives. when i connect as shown here https://learn.adafruit.com/using-an-infrared-library/hardware-needed
i keep getting random messages multiple times a second. I thought it was maybe noise but even if i cover the whole sensor it still registers.
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
Raw samples(2): Gap:410
Head: m65534 s4574
Extent=4572
Mark min:32767 max:0
Space min:32767 max:0
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
Raw samples(2): Gap:4290
Head: m70 s4574
Extent=4644
Mark min:32767 max:0
Space min:32767 max:0
any idea why it is doing this?
note: i know it works because if i point a remote it does decode messages correctly
Latest Library has compile errors when targeted to my AdaFruit Metro M4. Looks like IRHardware.h is missing SAMD51 updates. I edited my copy and was able to get a good compile and receiver test.
I'm sure you have a working version and I'm sure my version would have little value to you, especially since I was guessing a lot. When you get it updated I'd be happy to test for receive as well as transmit.
Bryon
Hi,
Here's another question from the series "is it possible to support another platform?", but I decided to give it a try :)
I'm using Feather WICED for my AWS IoT project, and it took me under an hour to get it going with AWS. Unfortunately, now I need to enable IR transmitter functionality, but it looks like that IRLib2 does not support STM32 chip used in Feather WICED. Is there any chance to get it working?
Thanks,
Dennis
I've donwloaded IRLib2-master.zib from gitHub and put it into my lib folder. Trying to add it with ".zib lib include under sketches results in "The folder doesn't contain a valid .zip lib"
Arduino: 1.6.12 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"
Angegebener Ordner/ZIP-Datei enthält keine gültige Bibliothek
Btw. is IRLib2 compatible with ESP8266?
Thank for any help
Do this new library support to send and receive RC6 36 bits code?
I'd like to build a dedicated IR repeater using a Adafruit 5V trinket (AtTiny85) but I did not see any info the this chip in the manual.
The satellite controller is in the living room. The output is split with a TV in the bedroom (one wall separates the 2)
I have a prototype running on a Uno. Any pointers to get this running on a trinket ?
Note: The size of the trinket is what makes it appealing for this project, I can hide it easily.
Thank you,
Sidney
Does the library have support for Particle Photon?
hi,
how can i use this library to send my own codes like /?! over an ir led at 300baud?
can't get it to work properly. i need to send that command to my smarmeter to get it to talk back to me.
In a simple project which uses the TONE library (I'm using a NANO) I tried to compile in the IR receiver software and..
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':
(.text+0x0): multiple definition of `__vector_7'
libraries\IRLibRecv\IRLibRecv.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Nano.
Arduino 1.6.9 on windows
In file included from C:\Users\xxx\Documents\Arduino\libraries\IRLib2\examples\pattern\pattern.ino:21:0:
C:\Users\xxx\Documents\Arduino\libraries\IRLibProtocols/IRLib_P11_RCMM.h:43:10: error: extra qualification 'IRsendRCMM::' on member 'send' [-fpermissive]
void IRsendRCMM::send(uint32_t data, uint8_t nBits= 12) {
^
Using library IRLibProtocols in folder: C:\Users\xxx\Documents\Arduino\libraries\IRLibProtocols (legacy)
exit status 1
Error compiling for board Arduino Nano.
Using IDE 1.8.5 in Windows 10 and a bare minimum sketch:
#include <IRLibAll.h>
void setup() {
}
void loop() {
//Continue looping until you get a complete signal received
}
It compiles to other boards, like Aurduino/genuíno Uno, but to MKR1000, got erros bellow:
In file included from C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLibProtocols/IRLibHardware.h:83:0,
from C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLib2\IRLibDecodeBase.cpp:11:
C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLibProtocols/IRLibSAMD21.h:88:80: error: missing binary operator before token "18"
#if ((IR_SEND_PWM_PIN > 21) || ( (IR_SEND_PWM_PIN > 12) && (IR_SEND_PWM_PIN 18)) )
^
C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLibProtocols/IRLibSAMD21.h:89:12: warning: missing terminating " character [enabled by default]
#error "Unsupported output pin on Arduino MKR 1000.
^
C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLibProtocols/IRLibSAMD21.h:124:12: warning: missing terminating " character [enabled by default]
#error "Unsupported output pin on Arduino M0 Pro
^
C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLibProtocols/IRLibSAMD21.h:133:12: warning: missing terminating " character [enabled by default]
#error "Unsupported output pin on Arduino Zero
^
C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLibProtocols/IRLibSAMD21.h:189:0: warning: "IR_CLEAR_INTERRUPT" redefined [enabled by default]
#define IR_CLEAR_INTERRUPT IR_TCx->COUNT16.INTFLAG.bit.MC0 = 1;
^
In file included from C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLib2\IRLibDecodeBase.cpp:11:0:
C:\Users\wagne\OneDrive\Documents\Arduino\libraries\IRLibProtocols/IRLibHardware.h:24:0: note: this is the location of the previous definition
#define IR_CLEAR_INTERRUPT {} //clear interrupt flag
^
exit status 1
Erro compilando para a placa Arduino/Genuino
Can you help? Thanks a lot!
I keep getting errors that these files are missing, both on Win and Mac.
I use Arch linux, with;
arduino 1.8.0
arduino-avr-core 1.6.17
arduino-builder 1.3.24
arduino-mk 1.5.2
avr-gcc 6.3.0
avrdude 6.3.2
I could not compile the code using Arduino IDE:
lto1: internal compiler error: in lto_output_varpool_node, at lto-cgraph.c:583
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.
lto-wrapper: fatal error: /usr/bin/avr-gcc returned 1 exit status
compilation terminated.
/usr/bin/avr-ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
nor Make:
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc-ar rcs build-uno/libcore.a build-uno/core/wiring.c.o build-uno/core/WInterrupts.c.o build-uno/core/wiring_digital.c.o build-uno/core/hooks.c.o build-uno/core/wiring_pulse.c.o build-uno/core/wiring_analog.c.o build-uno/core/wiring_shift.c.o build-uno/core/IPAddress.cpp.o build-uno/core/new.cpp.o build-uno/core/abi.cpp.o build-uno/core/WString.cpp.o build-uno/core/Tone.cpp.o build-uno/core/WMath.cpp.o build-uno/core/HardwareSerial0.cpp.o build-uno/core/Print.cpp.o build-uno/core/Stream.cpp.o build-uno/core/HardwareSerial2.cpp.o build-uno/core/USBCore.cpp.o build-uno/core/PluggableUSB.cpp.o build-uno/core/main.cpp.o build-uno/core/HardwareSerial.cpp.o build-uno/core/HardwareSerial1.cpp.o build-uno/core/CDC.cpp.o build-uno/core/HardwareSerial3.cpp.o build-uno/core/wiring_pulse.S.o build-uno/userlibs/IRLib2/IRLibRecvBase.cpp.o build-uno/userlibs/IRLib2/IRLibDecodeBase.cpp.o build-uno/userlibs/IRLib2/IRLibRecvLoop.cpp.o build-uno/userlibs/IRLibProtocols/IRLibSAMD21.cpp.o build-uno/userlibs/IRLibProtocols/IRLibProtocols.cpp.o build-uno/userlibs/IRLibProtocols/IRLibHardware.cpp.o build-uno/userlibs/IRLibProtocols/IRLibSendBase.cpp.o build-uno/userlibs/IRLibRecvPCI/IRLibRecvPCI.cpp.o build-uno/userlibs/arduino/IPAddress.cpp.o build-uno/userlibs/arduino/new.cpp.o build-uno/userlibs/arduino/abi.cpp.o build-uno/userlibs/arduino/WString.cpp.o build-uno/userlibs/arduino/Tone.cpp.o build-uno/userlibs/arduino/WMath.cpp.o build-uno/userlibs/arduino/HardwareSerial0.cpp.o build-uno/userlibs/arduino/Print.cpp.o build-uno/userlibs/arduino/Stream.cpp.o build-uno/userlibs/arduino/HardwareSerial2.cpp.o build-uno/userlibs/arduino/USBCore.cpp.o build-uno/userlibs/arduino/PluggableUSB.cpp.o build-uno/userlibs/arduino/main.cpp.o build-uno/userlibs/arduino/HardwareSerial.cpp.o build-uno/userlibs/arduino/HardwareSerial1.cpp.o build-uno/userlibs/arduino/CDC.cpp.o build-uno/userlibs/arduino/HardwareSerial3.cpp.o build-uno/userlibs/arduino/wiring.c.o build-uno/userlibs/arduino/WInterrupts.c.o build-uno/userlibs/arduino/wiring_digital.c.o build-uno/userlibs/arduino/hooks.c.o build-uno/userlibs/arduino/wiring_pulse.c.o build-uno/userlibs/arduino/wiring_analog.c.o build-uno/userlibs/arduino/wiring_shift.c.o build-uno/userlibs/arduino/wiring_pulse.S.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -mmcu=atmega328p -Wl,--gc-sections -Os -flto -fuse-linker-plugin -o build-uno/analyse.elf build-uno/analyze.cpp.o build-uno/libcore.a -lc -lm
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.
lto-wrapper: fatal error: /usr/share/arduino/hardware/tools/avr/bin/avr-gcc returned 1 exit status
compilation terminated.
/usr/bin/avr-ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [/usr/share/arduino/Arduino.mk:1443: build-uno/analyse.elf] Error 1
make -d
Finished prerequisites of target file 'build-uno/analyse.elf'. Must remake target 'build-uno/analyse.elf'.
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -mmcu=atmega328p -Wl,--gc-sections -Os -flto -fuse-linker-plugin -o build-uno/analyse.elf build-uno/analyze.cpp.o build-uno/libcore.a -lc -lm
Putting child 0x1f5f6d0 (build-uno/analyse.elf) PID 20633 on the chain.
Live child 0x1f5f6d0 (build-uno/analyse.elf) PID 20633
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.
lto-wrapper: fatal error: /usr/share/arduino/hardware/tools/avr/bin/avr-gcc returned 1 exit status
compilation terminated.
/usr/bin/avr-ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Reaping losing child 0x1f5f6d0 PID 20633
make: *** [/usr/share/arduino/Arduino.mk:1443: build-uno/analyse.elf] Error 1
Removing child 0x1f5f6d0 PID 20633 from chain.
It used to work earlier this year, I tried to downgrade avr-gcc down to v5, but I ended up using another library to get the IR code.. I can compile some example code (ie send.ino), but most seem broken due to various errors.
is there a plan to port this library to run on raspberry pi ?
Hi. Sorry for abusing Issues. Is fast(ish) two way communication between arduinos possible using this library? Possible in general?
I messed around with this example from your main competitor to no avail:
https://github.com/z3t0/Arduino-IRremote/blob/master/examples/IRtest2/IRtest2.ino
Maybe your library can do better?
When using the default dump code to see the codes my AC remote does all I get is this:
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
I'm using IRLibAll.h for this test.
I do get the codes for my samsung tv though ! NECx(7) 32bits
What would be required to further analyze and debug / implement its protocol ?
Thanks in advance.
IRLibDecodeBase uses Serial.print statements throughout to log information to the console.
In the SAMD21 M0 board, the method for printing to the USB console is exposed via SerialUSB.print.
As a result of this, when I tested any of the decode examples (using decoder.dumpResults) the arduino became unresponsive.
I found a quick fix by adding #define Serial SERIAL_PORT_USBVIRTUAL
to the IRLibDecodeBase.cpp file, which makes all the print statements work OK.
This might need to be added to other files wrapped in an #if
The example sketch rawRecv.ino compiles & runs fine, as do the various 'sending' examples, but
When I try to compile the example record.ino for my Nano ,on the arduino IDE (1.81) get these errors:
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,
from C:\Program Files (x86)\Arduino\libraries\IRLib2/IRLibGlobals.h:18,
from C:\Program Files (x86)\Arduino\libraries\IRLib2/IRLibRecvBase.h:20,
from C:\Program Files (x86)\Arduino\libraries\IRLibRecv\IRLibRecv.h:16,
from C:\Program Files (x86)\Arduino\libraries\IRLibRecv\IRLibRecv.cpp:13:
C:\Program Files (x86)\Arduino\libraries\IRLibProtocols/IRLibHardware.h:283:33: error: invalid use of 'extern' in linkage specification
#define IR_RECV_INTR_NAME ISR(TIMER2_COMPA_vect,ISR_NOBLOCK)
^
C:\Program Files (x86)\Arduino\libraries\IRLibRecv\IRLibRecv.cpp:84:5: note: in expansion of macro 'IR_RECV_INTR_NAME'
ISR(IR_RECV_INTR_NAME,ISR_NOBLOCK)
^
C:\Program Files (x86)\Arduino\libraries\IRLibProtocols/IRLibHardware.h:283:33: error: expected unqualified-id before string constant
#define IR_RECV_INTR_NAME ISR(TIMER2_COMPA_vect,ISR_NOBLOCK)
^
C:\Program Files (x86)\Arduino\libraries\IRLibRecv\IRLibRecv.cpp:84:5: note: in expansion of macro 'IR_RECV_INTR_NAME'
ISR(IR_RECV_INTR_NAME,ISR_NOBLOCK)
^
C:\Program Files (x86)\Arduino\libraries\IRLibRecv\IRLibRecv.cpp:84:23: error: '__vector_7' declared as function returning a function
ISR(IR_RECV_INTR_NAME,ISR_NOBLOCK)
^
C:\Program Files (x86)\Arduino\libraries\IRLibProtocols/IRLibHardware.h:283:33: error: expected unqualified-id before string constant
#define IR_RECV_INTR_NAME ISR(TIMER2_COMPA_vect,ISR_NOBLOCK)
^
C:\Program Files (x86)\Arduino\libraries\IRLibRecv\IRLibRecv.cpp:84:5: note: in expansion of macro 'IR_RECV_INTR_NAME'
ISR(IR_RECV_INTR_NAME,ISR_NOBLOCK)
^
C:\Program Files (x86)\Arduino\libraries\IRLibRecv\IRLibRecv.cpp:84:1: error: '__vector_7' declared as function returning a function
ISR(IR_RECV_INTR_NAME,ISR_NOBLOCK)
^
exit status 1
Error compiling for board Arduino Nano.
The definition to pass the frequency from IRLibCombo.h send case statement is using 'khz' parameter.
public:
void send(uint8_t protocolNum, uint32_t data, uint16_t data2=0, uint8_t khz=38) {
if(khz==0)khz=38;
switch(protocolNum) {
IR_SEND_PROTOCOL_01
However, the IRLib_P01_NEC.h is using 'data2' which is passing the wrong parameter for frequency.
#define IR_SEND_PROTOCOL_01 case 1: if(data2==0)data2=38;IRsendNEC::send(data,data2); break;
This should be changed to:
#define IR_SEND_PROTOCOL_01 case 1: if(khz==0)khz=38;IRsendNEC::send(data,khz); break;
I haven't been able to find a real answer yet, but would it be possible to use an Adafruit Trinket (ATTiny85) to implement a send-only version of this library? I'm building a little box to turn on the sound bar when the TV gets turned on, and I'd like to use a Trinket as the controller.
https://learn.adafruit.com/introducing-trinket/introduction
Is what I'd like to use. I know it's smaller in IO pins and memory, but it should be fast enough for what I need.
Trying to make an Arduino IR transmitter sleep between button presses, so an on/off switch is not required (like an off the shelf IR remote control). Thus, the batteries are always connected to a Arduino Pro Mini with regulator and led removed to save power during sleep.
The IR code works perfectly for different devices and functions when used without sleep. Sleep and sleep interrupt (on pin 2) seem to work fine by themselves. The problem is, the combined IR code/interrupt/sleep doesn't get the timing right- the gap between mark and space is greatly reduced, so the IR code is no longer received correctly. The sleep functions work correctly, and it does send IR, but with the timing not correct anymore.
#include <IRLibAll.h>
//#include <IRLib_P09_GICable.h>
//#include <IRLib_P02_Sony.h>
//#include <avr/power.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
//#include <avr/io.h>
//************************* This program doesn't work because ******************
//********************** sleep interferes with the timing ? *****
IRsend mySender; //defined output on pin 3 of UNO
const int buttonPin1 = 8; // the number of the pushbutton pin
const int buttonPin2 = A0;
volatile int buttonState1 = 1; // variable for reading the pushbutton status
volatile int buttonState2 = 1;
volatile byte state = LOW;
void setup() {
pinMode(13, OUTPUT);
pinMode(buttonPin1, INPUT_PULLUP); // led pin 3 already declared as output
pinMode(buttonPin2, INPUT_PULLUP);
pinMode(2,INPUT_PULLUP); //note a diode goes to each button, so pulling either button low triggers the interrupt
attachInterrupt(0,blink,FALLING);
}
void loop() {
//digitalWrite(13, state);
if (buttonState1 == LOW) {
IRsend mySender;
//send a code every time a character is received from the serial port
//Sony TV KDL-52S4100 (This code assumes the TV is on)- A90 12 bits is toggle power
mySender.send(GICABLE,0xF800, 16); // sends "pause the cable TV"
delay(400);
mySender.send(SONY,0xA50, 12); // sends "bring up input menu"
delay(400);
mySender.send(SONY,0xAF0, 12); // sends "cursor down" ie., HDMI 2
delay(400);
mySender.send(SONY,0xA70, 12); // sends "enter"
delay(400);
}
if (buttonState2 == LOW) {
send a code every time a character is received from the serial port
Sony TV KDL-52S4100
mySender.send(SONY,0xA50, 12); // sends "bring up input menu"
delay(400);
mySender.send(SONY,0x2F0, 12); // sends "cursor up" ie., HDMI 1
delay(400);
mySender.send(SONY,0xA70, 12); // sends "enter"
delay(400);
mySender.send(GICABLE,0x3C08, 16); // sends " rewind cable TV (and play)"
delay(400);
}
sleepNow(); // sleep function called here
}
void blink() {
buttonState1 = digitalRead(buttonPin1); //determine which button was pushed
buttonState2 = digitalRead(buttonPin2); //a diode per button connected to pin2
state = !state;
}
void sleepNow(void)
{
// Set pin 2 as interrupt and attach handler:
attachInterrupt(0,blink,FALLING);
delay(100);
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable();
sleep_bod_disable();
// Put the device to sleep:
sei(); //enable interrupts
sleep_cpu();
//
// Upon waking up, sketch continues from this point.
sleep_disable();
cli(); //disable interrupts
}
Hi,
I'm using IRLib2 for RC6 (RC6-6-32 [MCE Remote] to be exact) decoding. When it works, it works beautifully, so first of all thanks for the hard work!
I have a CCFL desk lamp which have ability to break IR decoding. When it's first starting up, it can generate some garbage on my TSOP38238's output (checked with a scope). Sometimes, this garbage signal can completely break IRLib2's decoding ability. When this issue occurs, for the rest of the session I can't receive any IR commands; only a power cycle / reset restores functionality.
Test sketch:
/* Includes */
#include <avr/wdt.h>
#include <IRLibRecv.h>
#include <IRLibDecodeBase.h>
#include <IRLib_P04_RC6.h>
#include <IRLibCombo.h>
/* Library init */
IRrecv myReceiver(2); // pin number for the IR receiver
IRdecode myDecoder;
void setup() {
// Setup WDT
wdt_enable(WDTO_2S);
myReceiver.enableIRIn(); // Start the receiver
Serial.begin(115200);
}
void loop() {
// IR receive and decode stuff
if (myReceiver.getResults()) {
if (myDecoder.decode()) {
Serial.println(myDecoder.value);
}
myReceiver.enableIRIn();
myDecoder.dumpResults(true);
}
}
Output when this issue happens:
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
Raw samples(100): Gap:1838
Head: m14546 s1838
0:m6354 s-22738 1:m-26414 s-14546 2:m22738 s1838 3:m-26414 s-6354
4:m30930 s1838 5:m-1838 s-6354 6:m-18222 s18222 7:m-26414 s-14546
8:m-18222 s-30930 9:m-18222 s-6354 10:m30930 s-6354 11:m30930 s1838
12:m6354 s-22738 13:m6354 s-6354 14:m22738 s18222 15:m-1838 s-30930
16:m-1838 s-30930 17:m-10030 s-14546 18:m-10030 s26414 19:m-18222 s-30930
20:m-1838 s-22738 21:m-18222 s-30930 22:m30930 s26414 23:m-18222 s1838
24:m-10030 s26414 25:m-26414 s-22738 26:m14546 s-6354 27:m30930 s-22738
28:m14546 s-14546 29:m-26414 s1838 30:m30930 s1838 31:m30930 s10030
32:m6354 s18222 33:m14546 s18222 34:m-18222 s-30930 35:m30930 s1838
36:m-26414 s-6354 37:m14546 s26414 38:m-10030 s-14546 39:m30930 s-30930
40:m30930 s-22738 41:m-26414 s18222 42:m-10030 s-6354 43:m-18222 s26414
44:m22738 s1838 45:m30930 s18222 46:m-26414 s1838 47:m-10030 s26414
48:m-26414
Extent=4294842578
Mark min:-26414 max:30930
Space min:1838 max:26414
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
Raw samples(100): Gap:26414
Head: m6354 s26414
0:m-10030 s-22738 1:m-10030 s-6354 2:m22738 s26414 3:m-10030 s10030
4:m-26414 s26414 5:m-26414 s10030 6:m6354 s-6354 7:m-10030 s-6354
8:m6354 s26414 9:m6354 s10030 10:m-26414 s10030 11:m-26414 s26414
12:m-10030 s-22738 13:m-10030 s10030 14:m22738 s-6354 15:m-26414 s26414
16:m-26414 s26414 17:m22738 s-6354 18:m22738 s10030 19:m6354 s26414
20:m-26414 s-22738 21:m6354 s26414 22:m-26414 s10030 23:m6354 s26414
24:m22738 s10030 25:m-10030 s-22738 26:m6354 s10030 27:m-26414 s-22738
28:m6354 s-6354 29:m-10030 s26414 30:m-26414 s26414 31:m-26414 s-22738
32:m-10030 s-6354 33:m6354 s-6354 34:m6354 s26414 35:m-26414 s26414
36:m-10030 s10030 37:m6354 s10030 38:m22738 s-6354 39:m-26414 s26414
40:m-26414 s-22738 41:m-10030 s-6354 42:m22738 s10030 43:m6354 s10030
44:m22738 s26414 45:m-26414 s-6354 46:m-10030 s26414 47:m22738 s10030
48:m-10030
Extent=121042
Mark min:-26414 max:22738
Space min:10030 max:26414
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
Raw samples(100): Gap:10030
Head: m55506 s10030
0:m22738 s-22738 1:m22738 s10030 2:m22738 s10030 3:m22738 s-22738
4:m-10030 s10030 5:m-10030 s-22738 6:m-10030 s10030 7:m22738 s10030
8:m-10030 s10030 9:m-10030 s-22738 10:m-10030 s-22738 11:m-10030 s10030
12:m22738 s-22738 13:m22738 s-22738 14:m22738 s10030 15:m-10030 s10030
16:m-10030 s10030 17:m22738 s10030 18:m22738 s-22738 19:m-10030 s10030
20:m-10030 s-22738 21:m-10030 s10030 22:m-10030 s-22738 23:m-10030 s10030
24:m22738 s-22738 25:m22738 s-22738 26:m-10030 s-22738 27:m-10030 s-22738
28:m-10030 s10030 29:m22738 s10030 30:m-10030 s10030 31:m-10030 s-22738
32:m22738 s10030 33:m-10030 s10030 34:m-10030 s10030 35:m-10030 s10030
36:m22738 s-22738 37:m-10030 s-22738 38:m22738 s10030 39:m-10030 s10030
40:m-10030 s-22738 41:m22738 s10030 42:m22738 s-22738 43:m-10030 s-22738
44:m22738 s10030 45:m-10030 s10030 46:m22738 s10030 47:m22738 s-22738
48:m22738
Extent=22738
Mark min:-10030 max:22738
Space min:10030 max:10030
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
Raw samples(100): Gap:42798
Head: m22738 s42798
0:m22738 s-22738 1:m22738 s-22738 2:m22738 s-22738 3:m22738 s-22738
4:m22738 s-22738 5:m22738 s-22738 6:m22738 s-22738 7:m22738 s-22738
8:m22738 s-22738 9:m22738 s-22738 10:m22738 s-22738 11:m22738 s-22738
12:m22738 s-22738 13:m22738 s-22738 14:m22738 s-22738 15:m22738 s-22738
16:m22738 s-22738 17:m22738 s-22738 18:m22738 s-22738 19:m22738 s-22738
20:m22738 s-22738 21:m22738 s-22738 22:m22738 s-22738 23:m22738 s-22738
24:m22738 s-22738 25:m22738 s-22738 26:m22738 s-22738 27:m22738 s-22738
28:m22738 s-22738 29:m22738 s-22738 30:m22738 s-22738 31:m22738 s-22738
32:m22738 s-22738 33:m22738 s-22738 34:m22738 s-22738 35:m22738 s-22738
36:m22738 s-22738 37:m22738 s-22738 38:m22738 s-22738 39:m22738 s-22738
40:m22738 s-22738 41:m22738 s-22738 42:m22738 s-22738 43:m22738 s-22738
44:m22738 s-22738 45:m22738 s-22738 46:m22738 s-22738 47:m22738 s-22738
48:m22738
Extent=22738
Mark min:22738 max:22738
Space min:32767 max:0
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
Raw samples(100): Gap:42798
Head: m22738 s42798
0:m22738 s-22738 1:m22738 s-22738 2:m22738 s-22738 3:m22738 s-22738
4:m22738 s-22738 5:m22738 s-22738 6:m22738 s-22738 7:m22738 s-22738
8:m22738 s-22738 9:m22738 s-22738 10:m22738 s-22738 11:m22738 s-22738
12:m22738 s-22738 13:m22738 s-22738 14:m22738 s-22738 15:m22738 s-22738
16:m22738 s-22738 17:m22738 s-22738 18:m22738 s-22738 19:m22738 s-22738
20:m22738 s-22738 21:m22738 s-22738 22:m22738 s-22738 23:m22738 s-22738
24:m22738 s-22738 25:m22738 s-22738 26:m22738 s-22738 27:m22738 s-22738
28:m22738 s-22738 29:m22738 s-22738 30:m22738 s-22738 31:m22738 s-22738
32:m22738 s-22738 33:m22738 s-22738 34:m22738 s-22738 35:m22738 s-22738
36:m22738 s-22738 37:m22738 s-22738 38:m22738 s-22738 39:m22738 s-22738
40:m22738 s-22738 41:m22738 s-22738 42:m22738 s-22738 43:m22738 s-22738
44:m22738 s-22738 45:m22738 s-22738 46:m22738 s-22738 47:m22738 s-22738
48:m22738
Extent=22738
Mark min:22738 max:22738
Space min:32767 max:0
Decoded Unknown(0): Value:0 Adrs:0 (0 bits)
Raw samples(100): Gap:42798
Head: m22738 s42798
0:m22738 s-22738 1:m22738 s-22738 2:m22738 s-22738 3:m22738 s-22738
4:m22738 s-22738 5:m22738 s-22738 6:m22738 s-22738 7:m22738 s-22738
8:m22738 s-22738 9:m22738 s-22738 10:m22738 s-22738 11:m22738 s-22738
12:m22738 s-22738 13:m22738 s-22738 14:m22738 s-22738 15:m22738 s-22738
16:m22738 s-22738 17:m22738 s-22738 18:m22738 s-22738 19:m22738 s-22738
20:m22738 s-22738 21:m22738 s-22738 22:m22738 s-22738 23:m22738 s-22738
24:m22738 s-22738 25:m22738 s-22738 26:m22738 s-22738 27:m22738 s-22738
28:m22738 s-22738 29:m22738 s-22738 30:m22738 s-22738 31:m22738 s-22738
32:m22738 s-22738 33:m22738 s-22738 34:m22738 s-22738 35:m22738 s-22738
36:m22738 s-22738 37:m22738 s-22738 38:m22738 s-22738 39:m22738 s-22738
40:m22738 s-22738 41:m22738 s-22738 42:m22738 s-22738 43:m22738 s-22738
44:m22738 s-22738 45:m22738 s-22738 46:m22738 s-22738 47:m22738 s-22738
48:m22738
Extent=22738
Mark min:22738 max:22738
Space min:32767 max:0
... (repeating last block indefinitely, only a power cycle / reset restores functionality at this point)
Note that when this occurs, turning the said lamp off (or toggling) doesn't change/fix this situation. So this is not a simple interference issue. Also I checked that is no electrical / EMI interference issue which directly affects the AVR or other board-level components and when issue happens rest of the code works normally, only IR decoding is broken.
Can you provide some pointers where to look at? Thanks.
Could you please give me a hint to enable the support for MKR1000. i can try to add it and propose it a pull request.
Thanks
The example is missing an include:
#include <IRLibDecodeBase.h>
Thanks for the update to the library. I have been using IRLib for a while and it has worked great.
A suggestion more than an issues - can you please number the pages in the manual. With 117 pages, I dread the first time I drop the bundle :-)
Thanks again.
Heya,
thanks for such a great library - I'm using it to decode IR signals to remotely control LED, which are driven by the FastLED library ( https://github.com/FastLED/FastLED).
All decoding works fine for me until call the FastLED.delay() function to set the frame-rate of the LEDS - after calling FastLED.delay(40), the signals of the IR receiver are not decoded correctly anymore ( they change everytime i press the same button on the control).
I am using the inbuilt "dump" example.
The code is modified is to show the issue.
I have a remove of "VU TV" remote model "ER-22645VU" which generates RC5 standard IR signals.
I press the keys only "once" but the program dumps it twice.
In the modified program the delay is reduced when we dumpResults with less detail. This creates the issue. When the dump is in full detail, the issue does not exist.
It seems like if there is enough delay between the getResults and the enableIRIn method calls the issue does not show up.
See attached file image.
Hello.
I am new here and i dont even think this is the right way to post things.
I spent last 3-4 days digging teh net for a library for arduino that understands my lego IR transmiters.
Turns out nothing out there that is available works. Codes i get from my IR are plain bullshit, bits dont fit anything.Apparently the decode function from older libs doesnt understand my Lego IR pilots.
As I understand, this library is an "evolved" version of what i tried to use.
Can anybody "include" Lego RC protocol in this library so i can finaly read some commands from lego pilot in my arduino ? I dont think i understand all the "encoding" and "us" ms to implement.....
Sample protocol description from LEGO:
http://storage.technicbricks.com/Media/2010/TBs_20100304_1/LEGO%20Power%20Functions%20RC%20v120.pdf
I couldnt find any newer i wonder if lego stopped publishing that document.
Would be cool if somebody answered...
Would you be able to add support for the trinket M0? I was able to edit the library and get it working. In IRLibHardware.h, I duplicated the #elif defined (__SAMD21G18A__)
cases and and used #elif defined (__SAMD21E18A__)
. I was able to use pin 1 on the trinket M0 and receive signals from an IR remote.
Hi there, I'm trying to use IRLib with my Adafruit Feather Huzza board but it looks like that it's not spported yet:
/Arduino/libraries/IRLibProtocols/IRLibHardware.h:190:47: error: 'COM2B1' was not declared in this scope
#define IR_SEND_PWM_STOP (TCCR2A &= ~(_BV(COM2B1)))
I saw that Feather M0 was supported, any chance to also support the Huzza ?
Dear community,
I try to decode an undocumented IR signal. So far (with lots of help from AnalysIR, thanks!!) we found out that it is:
a) Manchester encoding
b) bit length approx. 666 usec (meaning mark = 333 usec, space = 333 usec)
c) similar to RC5, but just raw bitstream, no header, no toogle bit
d) most-likely number of data bits = 13
As this protocol will not be recognized neither by irremote nor IRLib2, I was wondering if someone could give me a hint (or even small demo sketch) of how to translate raw manchester encoded data into (preferably hex) value? For now I always get different values as the timing of the signal is not too strict.
Thanks so much!
from /Users/john/Documents/Arduino/libraries/IRLib2/examples/dump/dump.ino:9:
/Users/john/Documents/Arduino/libraries/IRLibProtocols/IRLib_P08_Samsung36.h: In member function 'void IRsendSamsung36::send(uint32_t, uint32_t)':
/Users/john/Documents/Arduino/libraries/IRLibProtocols/IRLib_P08_Samsung36.h:53:12: warning: integer overflow in expression [-Woverflow]
space(118*500); //Lead out is 118 times the base time 500
^
118 * 500 = 59000 Too big for the default signed integer. Suggest changing to:
space(118U*500U); //Lead out is 118 times the base time 500
Hello,
I am planning to port IRLib2 to microblaze (FPGA based soft core) I only need the transmit option. Can you please point me in the right direction? Which files should I start from modifying?
Thanks
#include <IRLibSendBase.h>
#include <IRLib_P01_NEC.h>
#include <IRLibCombo.h>
#define buttonCode 0xF7E01F
IRsend sendir;
void setup()
{
// if i put it here, it doesn't work , no error
sendir.send(NEC,buttonCode,0);
}
void loop()
{
// it works here!
sendir.send(NEC,buttonCode,0);
}
what's wrong when I put it inside setup funciton?
Hi.
I want to emolate a IRreceiverDiode for an carradio. The Kenwood radio has a remote connction wire thats directly connected to the IRreceiver.
Now i want to attach a externel steering wheel remote to this wire without using IR... just send the unpulsed NEC command to the wire from the radio.
If i set IR_FREQ to 0 it is default at 38kHz
mySender.send(NEC,msg,0,IR_FREQ);
How can i set the frequency to 0?
Maybe make the uint8_t khz to an signed int with -1 as default and 0 is 0=0kHz.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.