You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-12Lines changed: 26 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,14 +50,17 @@ If you use an (old) Arduino core that does not use the `-flto` flag for compile,
50
50
- Now there is an **IRreceiver** and **IRsender** object like the well known Arduino **Serial** object.
51
51
- Just remove the line `IRrecv IrReceiver(IR_RECEIVE_PIN);` and/or `IRsend IrSender;` in your program, and replace all occurrences of `IRrecv.` or `irrecv.` with `IrReceiver`.
52
52
- Since the decoded values are now in `IrReceiver.decodedIRData` and not in `results` any more, remove the line `decode_results results` or similar.
53
-
- Like for the Serial object, call [`IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/ReceiveDemo/ReceiveDemo.ino#L38) or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);` instead of the `IrReceiver.enableIRIn();` or `irrecv.enableIRIn();` in setup().
53
+
- Like for the Serial object, call [`IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/ReceiveDemo/ReceiveDemo.ino#L38)
54
+
or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);` instead of the `IrReceiver.enableIRIn();` or `irrecv.enableIRIn();` in setup().
54
55
- Old `decode(decode_results *aResults)` function is replaced by simple `decode()`. So if you have a statement `if(irrecv.decode(&results))` replace it with `if (IrReceiver.decode())`.
55
-
- The decoded result is now in in `IrReceiver.decodedIRData` and not in `results` any more, therefore replace any occurrences of `results.value` and `results.decode_type` (and similar) to `IrReceiver.decodedIRData.decodedRawData` and `IrReceiver.decodedIRData.protocol`.
56
+
- The decoded result is now in in `IrReceiver.decodedIRData` and not in `results` any more, therefore replace any occurrences of `results.value` and `results.decode_type` (and similar) to
57
+
`IrReceiver.decodedIRData.decodedRawData` and `IrReceiver.decodedIRData.protocol`.
56
58
- Overflow, Repeat and other flags are now in [`IrReceiver.receivedIRData.flags`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremote.h#L126).
57
59
- Seldom used: `results.rawbuf` and `results.rawlen` must be replaced by `IrReceiver.decodedIRData.rawDataPtr->rawbuf` and `IrReceiver.decodedIRData.rawDataPtr->rawlen`.
58
60
59
61
# Do not want to convert your 2.x program and use the 3.x library version?
60
-
The 3.x versions try to be backwards compatible, so you can easily run your old examples. But some functions like e.g. `sendNEC()` -see below- could not made backwards compatible, so in this cases you must revisit your code and adapt it to the 3.x library.<br/>
62
+
The 3.x versions try to be backwards compatible, so you can easily run your old examples. But some functions like e.g. `sendNEC()` -see below- could not made backwards compatible,
63
+
so in this cases you must revisit your code and adapt it to the 3.x library.<br/>
61
64
If you program look like:
62
65
```
63
66
IRrecv irrecv(RECV_PIN);
@@ -80,7 +83,8 @@ void loop() {
80
83
```
81
84
it runs on the 3.x version as before. But only the following decoders are available then: Denon, JVC, LG, NEC, Panasonic, RC5, RC6, Samsung, Sony.
82
85
The `results.value` is set by the decoders for **NEC, Panasonic, Sony, Samsung and JVC** as MSB first like in 2.x!<br/>
83
-
- The old functions `sendNEC()` and `sendJVC()` are deprecated and renamed to `sendNECMSB()` and `sendJVCMSB()` to make it clearer that they send data with MSB first, which is not the standard for NEC and JVC. Use them to send your **old MSB-first 32 bit IR data codes**.
86
+
- The old functions `sendNEC()` and `sendJVC()` are deprecated and renamed to `sendNECMSB()` and `sendJVCMSB()` to make it clearer that they send data with MSB first,
87
+
which is not the standard for NEC and JVC. Use them to send your **old MSB-first 32 bit IR data codes**.
84
88
In the new version you will send NEC (and other) commands not by 32 bit codes but by a (constant) 8 bit address and an 8 bit command.
85
89
86
90
# How to convert old MSB first 32 bit IR data codes to new LSB first 32 bit IR data codes
@@ -98,7 +102,8 @@ Example:
98
102
Please do not use the old send*Raw() functions for sending like e.g. `IrSender.sendNECRaw(0xE61957A8,2)`,
99
103
even if this functions are used in a lot of **(old)** tutorials. They are only kept for backward compatibility and unsupported and error prone.<br/>
100
104
**Much better** is to use the **new structured functions** with address and command parameters like e.g. `IrSender.sendNEC(0xA8, 0x19, 2)`.
101
-
Especially if you are able to receive these remote codes and get the address and command values. You will discover that **the address is a constant** and the commands sometimes are sensibly grouped.
105
+
Especially if you are able to receive these remote codes and get the address and command values.
106
+
You will discover that **the address is a constant** and the commands sometimes are sensibly grouped.
102
107
103
108
# FAQ
104
109
- IR does not work right when I use **Neopixels** (aka WS2811/WS2812/WS2812B) or other libraries blocking interrupts for a longer time (> 50 us).<br/>
@@ -112,7 +117,7 @@ In turn, this stops the IR interrupt handler from running when it needs to. Ther
112
117
- The **minimal CPU frequency** for receiving is 4 MHz, since the 50 us timer ISR takes around 12 us on a 16 MHz ATmega.
113
118
114
119
# Minimal version
115
-
For applications only requiring NEC protocol, there is a receiver which has very **small codesize of 500 bytes and does NOT require any timer**. See the MinimalReceiver and IRDispatcherDemo example how to use it. Mapping of pins to interrupts can be found [here](https://github.com/Arduino-IRremote/Arduino-IRremote/tree/master/src/TinyIRReceiver.hpp#L307).
120
+
For applications only requiring NEC protocol, there is a receiver which has very **small code size of 500 bytes and does NOT require any timer**. See the MinimalReceiver and IRDispatcherDemo example how to use it. Mapping of pins to interrupts can be found [here](https://github.com/Arduino-IRremote/Arduino-IRremote/tree/master/src/TinyIRReceiver.hpp#L307).
116
121
117
122
# Handling unknown Protocols
118
123
## Disclaimer
@@ -154,8 +159,11 @@ In order to fit the examples to the 8K flash of ATtiny85 and ATtiny88, the [Ardu
154
159
### SimpleReceiver + SimpleSender
155
160
This examples are a good starting point.
156
161
157
-
### ReceiveDemo + SendDemo
158
-
More complete examples for the advanced user.
162
+
### ReceiveDemo
163
+
Receives all protocols and play a beep on each packet received. By connecting pin 5 to ground, you can see the raw values for each packet.
164
+
165
+
### SendDemo
166
+
Sends all available protocols at least once.
159
167
160
168
### ReceiveAndSend + UnitTest
161
169
ReceiveDemo + SendDemo in one program. **Receiving while sending**.
@@ -180,6 +188,12 @@ Control a relay (connected to an output pin) with your remote.
180
188
### IRremoteExtensionTest
181
189
Example for a user defined class, which itself uses the IRrecv class from IRremote.
182
190
191
+
### SendLGAirConditionerDemo
192
+
Example for sending LG air conditioner IR codes controlled by Serial input.<br/>
193
+
By just using the function `bool Aircondition_LG::sendCommandAndParameter(char aCommand, int aParameter)` you can control the air conditioner by any other command source.<br/>
194
+
The file *acLG.h* contains the command documentation of the LG air conditioner IR protocol. Based on reverse engineering of the LG AKB73315611 remote.
This example analyzes the signal delivered by your IR receiver module.
185
199
Values can be used to determine the stability of the received signal as well as a hint for determining the protocol.<br/>
@@ -189,7 +203,8 @@ Click on the receiver while simulation is running to specify individual NEC IR c
189
203
190
204
# Compile options / macros for this library
191
205
To customize the library to different requirements, there are some compile options / macros available.<br/>
192
-
Modify it by commenting them out or in, or change the values if applicable. Or define the macro with the -D compiler option for global compile (the latter is not possible with the Arduino IDE, so consider using [Sloeber](https://eclipse.baeyens.it).
206
+
Modify it by commenting them out or in, or change the values if applicable.
207
+
Or define the macro with the -D compiler option for global compile (the latter is not possible with the Arduino IDE, so consider using [Sloeber](https://eclipse.baeyens.it).
193
208
194
209
| Name | File | Default value | Description |
195
210
|-|-|-|-|
@@ -209,7 +224,6 @@ Modify it by commenting them out or in, or change the values if applicable. Or d
209
224
|`IR_SEND_DUTY_CYCLE`| IRremoteInt.h | 30 | Duty cycle of IR send signal. |
210
225
|`MICROS_PER_TICK`| IRremoteInt.h | 50 | Resolution of the raw input buffer data. |
211
226
|`IR_USE_AVR_TIMER*`| private/IRTimer.hpp || Selection of timer to be used for generating IR receiving sample interval. |
212
-
213
227
|-|-|-|-|
214
228
|`IR_INPUT_PIN`| TinyIRReceiver.h | 2 | The pin number for TinyIRReceiver IR input, which gets compiled in. |
215
229
|`IR_FEEDBACK_LED_PIN`| TinyIRReceiver.h |`LED_BUILTIN`| The pin number for TinyIRReceiver feedback LED, which gets compiled in. |
@@ -224,7 +238,7 @@ The modification must be renewed for each new IRremote library version!
224
238
225
239
### Modifying compile options with Sloeber IDE
226
240
If you are using Sloeber as your IDE, you can easily define global symbols with *Properties > Arduino > CompileOptions*.<br/>
Digispark boards are tested with the recommended [ATTinyCore](https://github.com/SpenceKonde/ATTinyCore) using `New Style` pin mapping for the pro board.
@@ -277,7 +291,7 @@ For the AVR platform the code to modify looks like:
277
291
You **just have to modify the comments** of the current and desired timer line.
278
292
But be aware that the new timer in turn might be incompatible with other libraries or commands.<br/>
279
293
The modification must be renewed for each new IRremote library version, or you use an IDE like [Sloeber](https://github.com/Arduino-IRremote/Arduino-IRremote#modifying-compile-options-with-sloeber-ide).<br/>
280
-
For other platforms you must modify the approriate section guarded by e.g. `#elif defined(ESP32)`.
294
+
For other platforms you must modify the appropriate section guarded by e.g. `#elif defined(ESP32)`.
281
295
282
296
Another approach can be to share the timer **sequentially** if their functionality is used only for a short period of time like for the **Arduino tone() command**.
283
297
An example can be seen [here](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/21b5747a58e9d47c9e3f1beb056d58c875a92b47/examples/ReceiveDemo/ReceiveDemo.ino#L159-L169), where the timer settings for IR receive are restored after the tone has stopped.
- Added Kaseikyo convenience functions like sendKaseikyo_Denon().
13
+
- Improved LG protocol and added class Aircondition_LG based on real hardware supplied by makerspace 201 (https://wiki.hackerspaces.org/ZwoNullEins) from Cologne.
14
+
- Improved universal decoder for pulse width or pulse distance protocols to support more than 32 bits.
1690/*1111 inverted 0 of command*/, 560/*stop bit*/}; // Using exact NEC timing
139
139
IrSender.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), NEC_KHZ); // Note the approach used to automatically calculate the size of the array.
140
140
delay(DELAY_AFTER_SEND);
141
141
#endif
142
142
/*
143
143
* With sendNECRaw() you can send 32 bit combined codes
144
144
*/
145
-
Serial.println(
146
-
F(
147
-
"Send NEC / ONKYO with 16 bit address 0x0102 and 16 bit command 0x0304 with NECRaw(0x03040102)"));
145
+
Serial.println(F("Send NEC / ONKYO with 16 bit address 0x0102 and 16 bit command 0x0304 with NECRaw(0x03040102)"));
148
146
Serial.flush();
149
147
IrSender.sendNECRaw(0x03040102, sRepeats);
150
148
delay(DELAY_AFTER_SEND);
151
149
150
+
Serial.println(F("Send NEC with 16 bit address 0x0102 and 16 bit command 0x0304 with sendPulseDistanceWidthData()"));
0 commit comments