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
@@ -226,22 +231,31 @@ You will discover that **the address is a constant** and the commands sometimes
226
231
http://www.harctoolbox.org/IR-resources.html
227
232
228
233
# FAQ and hints
229
-
- IR does not work right when I use **Neopixels** (aka WS2811/WS2812/WS2812B) or other libraries blocking interrupts for a longer time (> 50 µs).<br/>
230
-
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.
234
+
235
+
## Problems with Neopixels, FastLed etc.
236
+
IR will not work right when you use **Neopixels** (aka WS2811/WS2812/WS2812B) or other libraries blocking interrupts for a longer time (> 50 µs).<br/>
237
+
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.
231
238
In turn, this stops the IR interrupt handler from running when it needs to.<br/>
232
239
You can try to wait for the IR receiver to be idle before you send the Neopixel data with `if (IrReceiver.isIdle()) { strip.show();}`. This prevents at least breaking a running IR transmission and -depending of the update rate of the Neopixel- may work quite well.<br/>
233
240
There are some other solutions to this on more powerful processors,
234
-
[see this page from Marc MERLIN](http://marc.merlins.org/perso/arduino/post_2017-04-03_Arduino-328P-Uno-Teensy3_1-ESP8266-ESP32-IR-and-Neopixels.html)
235
-
- **Another library** is only working if I deactivate the line `IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);`. Please see [below](https://github.com/Arduino-IRremote/Arduino-IRremote#timer-and-pin-usage).
236
-
- You can use **multiple IR receiver** by just connecting the output pins of several IR receivers together.
237
-
The IR receivers use an NPN transistor as output device with just a 30k resistor to VCC.
238
-
This is almost "open collector" and allows connecting of several output pins to one Arduino input pin.
239
-
- The **minimal CPU frequency** for receiving is 4 MHz, since the 50 µs timer ISR takes around 12 µs on a 16 MHz ATmega.
240
-
- To **increase strength of sent output signal** you can increase the current through the send diode, and/or use 2 diodes in series,
241
+
[see this page from Marc MERLIN](http://marc.merlins.org/perso/arduino/post_2017-04-03_Arduino-328P-Uno-Teensy3_1-ESP8266-ESP32-IR-and-Neopixels.html)
242
+
243
+
## Does not work/compile with another library
244
+
**Another library** is only working if you deactivate the line `IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);`.
245
+
This is often due to resource conflicts with the other library. Please see [below](https://github.com/Arduino-IRremote/Arduino-IRremote#timer-and-pin-usage).
246
+
247
+
## Multiple IR receiver
248
+
You can use **multiple IR receiver** by just connecting the output pins of several IR receivers together.
249
+
The IR receivers use an NPN transistor as output device with just a 30k resistor to VCC.
250
+
This is almost "open collector" and allows connecting of several output pins to one Arduino input pin.
251
+
252
+
## Increase strength of sent output signal
253
+
To **increase strength of sent output signal** you can increase the current through the send diode, and/or use 2 diodes in series,
241
254
since one IR diode requires only 1.5 volt.
242
-
- The line \#include "ATtinySerialOut.h" in PinDefinitionsAndMore.h (requires the library to be installed) saves 370 bytes program memory and 38 bytes RAM for **Digispark boards** as well as enables serial output at 8MHz.
243
-
- The default software generated PWM has **problems on AVR running with 8 MHz**. The PWM frequency is around 30 instead of 38 kHz and RC6 is not reliable. You can switch to timer PWM generation by `#define SEND_PWM_BY_TIMER`.
244
255
256
+
## Minimal CPU frequency
257
+
For receiving, the **minimal CPU frequency is 4 MHz**, since the 50 µs timer ISR takes around 12 µs on a 16 MHz ATmega.<br/>
258
+
For sending, the **default software generated PWM has problems on AVR running with 8 MHz**. The PWM frequency is around 30 instead of 38 kHz and RC6 is not reliable. You can switch to timer PWM generation by `#define SEND_PWM_BY_TIMER`.
245
259
246
260
# Handling unknown Protocols
247
261
## Disclaimer
@@ -290,7 +304,7 @@ In order to fit the examples to the 8K flash of ATtiny85 and ATtiny88, the [Ardu
290
304
This examples are a good starting point.
291
305
292
306
### ReceiveDemo
293
-
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.
307
+
Receives all protocols and **generates a beep with the Arduino tone() function** on each packet received. By connecting pin 5 to ground, you can see the raw values for each packet. **Example how to use IRremote and tone() together**.
294
308
295
309
### ReceiveDump
296
310
Receives all protocols and dumps the received signal in different flavors. Since the printing takes so much time, repeat signals may be skipped or interpreted as UNKNOWN.
uint16_t address; // to distinguish between multiple senders
57
57
uint16_t command;
58
58
bool isRepeat;
59
-
uint32_t MillisOfLastCode; // millis() of last IR command received - for timeouts etc.
59
+
uint32_t MillisOfLastCode; // millis() of last IR command -including repeats!- received - for timeouts etc.
60
60
volatilebool isAvailable; // flag for a polling interpreting function, that a new command has arrived.
61
61
};
62
62
@@ -75,7 +75,7 @@ class IRCommandDispatcher {
75
75
voidinit();
76
76
77
77
boolcheckAndRunNonBlockingCommands();
78
-
voidcheckAndRunSuspendedBlockingCommands();
78
+
boolcheckAndRunSuspendedBlockingCommands();
79
79
booldelayAndCheckForStop(uint16_t aDelayMillis);
80
80
81
81
// The main dispatcher function
@@ -90,6 +90,7 @@ class IRCommandDispatcher {
90
90
uint8_t BlockingCommandToRunNext = COMMAND_INVALID; // Storage for command currently suspended to allow the current command to end, before it is called by main loop
91
91
/*
92
92
* Flag for running blocking commands to terminate. To check, you can use "if (requestToStopReceived) return;" (available as macro RETURN_IF_STOP).
93
+
* Is reset by next IR command received. Can be reset by main loop, if command has stopped.
0 commit comments