Day 17: IR module
Today’s project permits controlling the controller by remote control. You can change the colour of the RGB-LED with buttons you can choose on an infra-red remote control, and change the background colour of the website right along with it.
Behind today’s door, you will find the important part of today’s project, i.e. the infra-red receiver module. You can connect the module without a cable as shown in the figure below. The program sets the corresponding pins so that the module is supplied with power.
The program: Day17_IRmodul
Today’s program once again uses an external library: the IRremote-Library by Ken Shiriff. A copy of the version used by me is again enclosed in the Sketch folder and only needs to be copied into the library folder of your Sketchbook.
After uploading the program, you should start the Serial Monitor. Find a remote control and point it at the module. When you push a button, you should have the value of the signal output as a HEX code and the type of the protocol as a number in the monitor. When the type is displayed as -1, the protocol has not been recognised. There may be several failed attempts before a command is properly decoded. Just try out a bit or try another remote control. Once you have found a working one, select six buttons (best take Power, Volume up, Volume down, Channel up, Channel down and Mute). Now copy the codes for the six commands in the program behind the six #define irComX (do not forget the 0x before the hex code). The commands of an LG-TV remote control are pre-defined there. If you have entered the codes correctly, you can upload the program again. You can use the buttons defined by you to change the colour of the RGB-LED now. When updating the board page, you will also see that the colour has changed.