Skip to content

Infrared Control

Aircoookie edited this page Nov 20, 2018 · 8 revisions

In v0.8.2, infrared control from 24-key RGB remotes will be possible.

A dedicated infrared receiver module is required. (KY-022 is confirmed to work and inexpensive)

The default sensor pin is GPIO4. It can only be changed in NpbWrapper.h

More documentation will be added shortly. This feature is not yet included in any branches.

How to add custom codes

Have a random remote laying around? Or a button on your TV remote that does nothing? You can make these compatible with WLED if they use a 38kHz carrier frequency like most IR remotes do.

Firstly, uncomment #define WLED_DEBUG in wled00.ino. Then, compile and upload and open the serial monitor. Try pressing the button(s) you'd like to program. If your receiver is connected correctly, you should see something like this printed to the serial monitor:

IR recv
FFDE10

In this example, FFDE10 is the infrared code in HEX. If you get FFFFFFFF, the same code was received multiple times - try only tapping the remote button for a very brief time.

Now, open the file ir_codes.h and add your IR code by adding (for example) #define IRCUSTOM_MACRO1 0xFFDE10. You just add 0x before your hex IR code and name it IRCUSTOM_X, where X should represent the action you want the code to trigger (like apply MACRO1 or toggle ONOFF).

Almost done! Open wled19_ir.ino and add your IR code into the switch structure in the decodeIrCustom() method. You should be able to follow the existing code to program your desired action. For example, you could do case IRCUSTOM_MACRO1: applyMacro(1); break; to apply the first API macro.

Clone this wiki locally