IRremote library API

jorenheit edited this page Dec 18, 2014 · 3 revisions

The API uses an IRsend object to send a code, and an IRrecv object to receive a code. The library cannot send and receive at the same time, but can switch between sending and receiving.


IRsend irsend;

Creates a send object

irsend.sendNEC(data, bits)

Sends the value as an NEC-format IR code. bits specifies the length of the code, typically 16.

irsend.sendSony(data, bits)

Sends the value as a Sony-format IR code.

irsend.sendRC5(data, bits)

Sends the value as a RC5-format IR code.

irsend.sendRC6(data, bits)

Sends the value as a RC6-format IR code.

irsend.sendRaw(buf, len, hertz)

Sends a code corresponding to the buffer of raw durations.


IRrecv irrecv(pin);

Creates a receiver object.


Starts listening for an IR code.

int irrecv.decode(&results)

Returns 1 if there is a received code available, and 0 otherwise.
The fields of results are:

decode_type NEC, SONY, RC5, RC6, or UNKNOWN
value the received code value
bits The number of bits received
rawbuf[] Raw durations
rawlen Number of records in rawbuf

This must be called after irrecv.decode() to resume listening for a code.

You can’t perform that action at this time.
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.
Press h to open a hovercard with more details.