User manual

uses the timing information and the number of bits to see if it matches one of the supported
protocols. If it succeeds, it returns "true" although in this sketch we did not bother to check that first.
You can access the protocol number in My_Decoder.decode_type, the number of bits in
My_Decoder.bits and the the decoded data value in My_Decoder.value.
At the top of the sketch we created the decoder object as type "IRdecode". This is a class which
incorporates all seven of the supported protocols. If you're using the library to control a device such
as a servo or turn relays off and on, you probably are going to be using one remote with one
protocol. Once you know which protocol you are using, you may wish to use a different decoder
class that only works for your particular protocol. It can save valuable program space in your sketch.
For example if we were using the Adafruit Mini Remote which uses NEC protocol would change line
#7 to read:
Protocol Specific Issues
IRLib supports 7 protocols directly and includes example code on how to implement 4 others. As
stated earlier, one of the jobs of a library is to isolate the application programmer from the need to
deal with internal issues. However there are some protocol specific things that you may need to deal
with.
The protocols are enumerated in IRLib.h at approximately line 60 as follows.
Here are some protocol specific issues you may have to deal with.
NEC Repeat Codes
The NEC protocol uses a special sequence of marks and spaces that mean "I held down the button
so you should repeat whatever I sent you last time". It is up to you to decide do I want to allow
repeat codes or do I want to force the operator to push and release the button each time. IRLib
returns a value of 0xFFFFFFFF to tell you that the special repeat sequence was received. You can
IRdecodeNEC My_Decoder;
typedef char IRTYPES; //formerly was an enum
#define UNKNOWN 0
#define NEC 1
#define SONY 2
#define RC5 3
#define RC6 4
#define PANASONIC_OLD 5
#define JVC 6
#define NECX 7
© Adafruit Industries https://learn.adafruit.com/using-an-infrared-library Page 9 of 23