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
disabled old results structure, added default receiver and sender objects, removed deprecated decoders with parameter, added Stram like API with begin() -like Arduino Serial-, LED feedback now also for send
This is a quite old but maybe useful wiki for this library.
29
29
30
+
# Converting your program to the 3.x version
31
+
- Now there is an **IRreceiver** and **IRsender** object like the well known Arduino **Serial** object.
32
+
- Just remove the line `IRrecv IrReceiver(IR_RECEIVE_PIN);` and/or `IRsend IrSender;`in your program.
33
+
- Like for the Serial object, call `[IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);](https://github.com/Arduino-IRremote/Arduino-IRremote/examples/IRreceiveDemo/IRreceiveDemo.ino#L38)` or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);` instead of the `IrReceiver.enableIRIn();` in setup().
34
+
- Old `decode(decode_results *aResults)` is replaced by simple `decode()`.
35
+
- Overflow and many other flags are now in [IrReceiver.receivedIRData.flags](https://github.com/Arduino-IRremote/Arduino-IRremote/src/IRremote.h#L126).
36
+
37
+
If you discover more changes, which should be documented, please send me a mail to [email protected].
38
+
30
39
# FAQ
31
40
- IR does not work right when I use Neopixels (aka WS2811/WS2812/WS2812B)<br/>
32
41
Whether you use the Adafruit Neopixel lib, or FastLED, interrupts get disabled on many lower end CPUs like the basic Arduinos for longer than 50 µs.
@@ -76,6 +85,7 @@ Modify it by commenting them out or in, or change the values if applicable. Or d
76
85
|`USE_SOFT_SEND_PWM`| IRremote.h | disabled | Use carrier PWM generation in software, instead of hardware PWM. |
77
86
|`PULSE_CORRECTION_MICROS`| IRremote.h | 3 | If USE_SOFT_SEND_PWM, this amount is subtracted from the on-time of the pulses. |
78
87
|`USE_SPIN_WAIT`| IRremote.h | disabled | If USE_SOFT_SEND_PWM, use spin wait instead of delayMicros(). |
88
+
|`SUPPORT_SEND_EXOTIC_PROTOCOLS`| IRremote.h | enabled | If activated, BOSEWAVE and LEGO_PF are supported in the write method. Costs around 500 bytes program space. |
79
89
|`RAW_BUFFER_LENGTH`| IRremoteint.h | 101 | Buffer size of raw input buffer. Must be odd! |
80
90
|`IR_SEND_DUTY_CYCLE`| IRremoteBoardDefs.h | 30 | Duty cycle of IR send signal. |
81
91
|`MICROS_PER_TICK`| IRremoteBoardDefs.h | 50 | Resolution of the raw input buffer data. |
@@ -84,6 +94,7 @@ Modify it by commenting them out or in, or change the values if applicable. Or d
84
94
|`IR_FEEDBACK_LED_PIN`| TinyIRReceiver.h |`LED_BUILTIN`| The pin number for TinyIRReceiver feedback LED, which gets compiled in. |
85
95
|`DO_NOT_USE_FEEDBACK_LED`| TinyIRReceiver.h | disabled | Enable it to disable the feedback LED function. |
86
96
97
+
87
98
### Modifying compile options with Arduino IDE
88
99
First use *Sketch > Show Sketch Folder (Ctrl+K)*.<br/>
89
100
If you did not yet stored the example as your own sketch, then you are instantly in the right library folder.<br/>
Copy file name to clipboardExpand all lines: examples/IR2Keyboard/IR2Keyboard.ino
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,6 @@ int IR_RECEIVE_PIN = 10;
40
40
#else
41
41
int IR_RECEIVE_PIN = 11;
42
42
#endif
43
-
IRrecv IrReceiver(IR_RECEIVE_PIN);
44
43
45
44
// On the Zero and others we switch explicitly to SerialUSB
46
45
#if defined(ARDUINO_ARCH_SAMD)
@@ -63,8 +62,8 @@ void setup() {
63
62
// In case the interrupt driver crashes on setup, give a clue
64
63
// to the user what's going on.
65
64
Serial.println("Enabling IRin");
66
-
IrReceiver.enableIRIn(); // Start the receiver
67
-
IrReceiver.blink13(true); // Enable feedback LED
65
+
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the receiver, enable feedback LED, take LED feedback pin from the internal boards definition
66
+
68
67
69
68
Serial.print(F("Ready to receive IR signals at pin "));
Copy file name to clipboardExpand all lines: examples/IRreceiveDemo/IRreceiveDemo.ino
+23-13Lines changed: 23 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,6 @@ int IR_RECEIVE_PIN = 10;
16
16
#else
17
17
int IR_RECEIVE_PIN = 11;
18
18
#endif
19
-
IRrecv IrReceiver(IR_RECEIVE_PIN);
20
19
21
20
// On the Zero and others we switch explicitly to SerialUSB
22
21
#if defined(ARDUINO_ARCH_SAMD)
@@ -36,8 +35,7 @@ void setup() {
36
35
// In case the interrupt driver crashes on setup, give a clue
37
36
// to the user what's going on.
38
37
Serial.println("Enabling IRin");
39
-
IrReceiver.enableIRIn(); // Start the receiver
40
-
IrReceiver.blink13(true); // Enable feedback LED
38
+
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the receiver, enable feedback LED, take LED feedback pin from the internal boards definition
41
39
42
40
Serial.print(F("Ready to receive IR signals at pin "));
43
41
Serial.println(IR_RECEIVE_PIN);
@@ -49,21 +47,37 @@ void loop() {
49
47
* Decoded result is in the IrReceiver.decodedIRData structure.
50
48
*/
51
49
if (IrReceiver.decode()) {
52
-
// Print a short summary of received data
53
-
IrReceiver.printIRResultShort(&Serial);
54
-
if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
// Just to know which program is running on my Arduino
39
38
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
40
39
41
-
IrReceiver.enableIRIn(); // Start the receiver
42
-
IrReceiver.blink13(true); // Enable feedback LED
40
+
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the receiver, enable feedback LED, take LED feedback pin from the internal boards definition
43
41
44
42
Serial.print(F("Ready to receive IR signals at pin "));
45
43
Serial.println(IR_RECEIVE_PIN);
@@ -64,9 +62,9 @@ void loop() {
64
62
IrReceiver.printIRResultRawFormatted(&Serial, true); // Output the results in RAW format
65
63
Serial.println(); // blank line between entries
66
64
Serial.println(F("Result as internal ticks (50 us) array - compensated with MARK_EXCESS_MICROS"));
67
-
IrReceiver.compensateAndPrintIRResultAsCArray(&Serial, false); // Output the results as uint8_t source code array of ticks
65
+
IrReceiver.compensateAndPrintIRResultAsCArray(&Serial, false); // Output the results as uint8_t source code array of ticks
68
66
Serial.println(F("Result as microseconds array - compensated with MARK_EXCESS_MICROS"));
69
-
IrReceiver.compensateAndPrintIRResultAsCArray(&Serial, true); // Output the results as uint16_t source code array of micros
67
+
IrReceiver.compensateAndPrintIRResultAsCArray(&Serial, true); // Output the results as uint16_t source code array of micros
70
68
IrReceiver.printIRResultAsCVariables(&Serial); // Output address and data as source code variables
0 commit comments