IRremote
Sending IR data for multiple protocols

Functions

 IRsend::IRsend ()
 
 IRsend::IRsend (uint_fast8_t aSendPin)
 
void IRsend::begin (uint_fast8_t aSendPin)
 Initializes the send pin and enable LED feedback with board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions. More...
 
void IRsend::setSendPin (uint_fast8_t aSendPin)
 
void IRsend::begin (uint_fast8_t aSendPin, bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin)
 Initializes the send and feedback pin. More...
 
size_t IRsend::write (IRData *aIRSendData, int_fast8_t aNumberOfRepeats=NO_REPEATS)
 Interprets and sends a IRData structure. More...
 
void IRsend::sendRaw (const uint16_t aBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz)
 Function using an 16 byte microsecond timing array for every purpose. More...
 
void IRsend::sendRaw (const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz)
 Function using an 8 byte tick timing array to save program memory Raw data starts with a Mark. More...
 
void IRsend::sendRaw_P (const uint16_t aBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz)
 Function using an 16 byte microsecond timing array in FLASH for every purpose. More...
 
void IRsend::sendRaw_P (const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz)
 New function using an 8 byte tick timing array in FLASH to save program memory Raw data starts with a Mark. More...
 
void IRsend::sendPulseDistanceWidthFromArray (uint_fast8_t aFrequencyKHz, unsigned int aHeaderMarkMicros, unsigned int aHeaderSpaceMicros, unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros, unsigned int aZeroSpaceMicros, IRRawDataType *aDecodedRawDataArray, unsigned int aNumberOfBits, bool aMSBfirst, bool aSendStopBit, unsigned int aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats)
 Sends PulseDistance data from array For LSB First the LSB of array[0] is sent first then all bits until MSB of array[0]. More...
 
void IRsend::sendPulseDistanceWidthFromArray (PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType *aDecodedRawDataArray, unsigned int aNumberOfBits, int_fast8_t aNumberOfRepeats)
 Sends PulseDistance data from array using PulseDistanceWidthProtocolConstants For LSB First the LSB of array[0] is sent first then all bits until MSB of array[0]. More...
 
void IRsend::sendPulseDistanceWidth (PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
 Sends PulseDistance frames and repeats. More...
 
void IRsend::sendPulseDistanceWidth (uint_fast8_t aFrequencyKHz, unsigned int aHeaderMarkMicros, unsigned int aHeaderSpaceMicros, unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros, unsigned int aZeroSpaceMicros, IRRawDataType aData, uint_fast8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit, unsigned int aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats, void(*aSpecialSendRepeatFunction)()=NULL)
 Sends PulseDistance frames and repeats. More...
 
void IRsend::sendPulseDistanceWidthData (PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits)
 Sends PulseDistance data The output always ends with a space Each additional call costs 16 bytes program memory. More...
 
void IRsend::sendPulseDistanceWidthData (unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros, unsigned int aZeroSpaceMicros, IRRawDataType aData, uint_fast8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit)
 Sends PulseDistance data The output always ends with a space. More...
 
void IRsend::sendBiphaseData (unsigned int aBiphaseTimeUnit, uint32_t aData, uint_fast8_t aNumberOfBits)
 Sends Biphase data MSB first Always send start bit, do not send the trailing space of the start bit 0 -> mark+space 1 -> space+mark The output always ends with a space can only send 31 bit data, since we put the start bit as 32th bit on front. More...
 
void IRsend::mark (unsigned int aMarkMicros)
 Sends an IR mark for the specified number of microseconds. More...
 
void IRsend::IRLedOff ()
 Just switch the IR sending LED off to send an IR space A space is "no output", so the PWM output is disabled. More...
 
static void IRsend::space (unsigned int aSpaceMicros)
 Sends an IR space for the specified number of microseconds. More...
 
static void IRsend::customDelayMicroseconds (unsigned long aMicroseconds)
 Custom delay function that circumvents Arduino's delayMicroseconds 16 bit limit and is (mostly) not extended by the duration of interrupt codes like the millis() interrupt. More...
 
void IRsend::enableIROut (uint_fast8_t aFrequencyKHz)
 Enables IR output. More...
 
unsigned int IRsend::getPulseCorrectionNanos ()
 

Variables

IRsend IrSender
 

Detailed Description

Function Documentation

◆ IRsend() [1/2]

IRsend::IRsend ( )

Definition at line 61 of file IRSend.hpp.

◆ IRsend() [2/2]

IRsend::IRsend ( uint_fast8_t  aSendPin)

Definition at line 101 of file IRSend.hpp.

◆ begin() [1/2]

void IRsend::begin ( uint_fast8_t  aSendPin)

Initializes the send pin and enable LED feedback with board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions.

Parameters
aSendPinThe Arduino pin number, where a IR sender diode is connected.

Definition at line 112 of file IRSend.hpp.

◆ begin() [2/2]

void IRsend::begin ( uint_fast8_t  aSendPin,
bool  aEnableLEDFeedback,
uint_fast8_t  aFeedbackLEDPin 
)

Initializes the send and feedback pin.

Parameters
aSendPinThe Arduino pin number, where a IR sender diode is connected.
aEnableLEDFeedbackIf true the feedback LED is activated while receiving or sending a PWM signal /a mark
aFeedbackLEDPinIf 0 / USE_DEFAULT_FEEDBACK_LED_PIN, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions

Definition at line 129 of file IRSend.hpp.

◆ customDelayMicroseconds()

void IRsend::customDelayMicroseconds ( unsigned long  aMicroseconds)
static

Custom delay function that circumvents Arduino's delayMicroseconds 16 bit limit and is (mostly) not extended by the duration of interrupt codes like the millis() interrupt.

Definition at line 935 of file IRSend.hpp.

◆ enableIROut()

void IRsend::enableIROut ( uint_fast8_t  aFrequencyKHz)

Enables IR output.

The kHz value controls the modulation frequency in kilohertz. IF PWM should be generated by a timer, it uses the platform specific timerConfigForSend() function, otherwise it computes the delays used by the mark() function. If IR_SEND_PIN is defined, maximum PWM frequency for an AVR @16 MHz is 170 kHz (180 kHz if NO_LED_FEEDBACK_CODE is defined)

Definition at line 961 of file IRSend.hpp.

◆ getPulseCorrectionNanos()

unsigned int IRsend::getPulseCorrectionNanos ( )

Definition at line 998 of file IRSend.hpp.

◆ IRLedOff()

void IRsend::IRLedOff ( )

Just switch the IR sending LED off to send an IR space A space is "no output", so the PWM output is disabled.

This function may affect the state of feedback LED.

Definition at line 894 of file IRSend.hpp.

◆ mark()

void IRsend::mark ( unsigned int  aMarkMicros)

Sends an IR mark for the specified number of microseconds.

The mark output is modulated at the PWM frequency if USE_NO_SEND_PWM is not defined. The output is guaranteed to be OFF / inactive after after the call of the function. This function may affect the state of feedback LED.

Definition at line 757 of file IRSend.hpp.

◆ sendBiphaseData()

void IRsend::sendBiphaseData ( unsigned int  aBiphaseTimeUnit,
uint32_t  aData,
uint_fast8_t  aNumberOfBits 
)

Sends Biphase data MSB first Always send start bit, do not send the trailing space of the start bit 0 -> mark+space 1 -> space+mark The output always ends with a space can only send 31 bit data, since we put the start bit as 32th bit on front.

Definition at line 706 of file IRSend.hpp.

◆ sendPulseDistanceWidth() [1/2]

void IRsend::sendPulseDistanceWidth ( PulseDistanceWidthProtocolConstants aProtocolConstants,
IRRawDataType  aData,
uint_fast8_t  aNumberOfBits,
int_fast8_t  aNumberOfRepeats 
)

Sends PulseDistance frames and repeats.

Parameters
aProtocolConstantsThe constants to use for sending this protocol.
aDatauint32 or uint64 holding the bits to be sent.
aNumberOfBitsNumber of bits from aData to be actually sent.
aNumberOfRepeatsIf < 0 and a aProtocolConstants->SpecialSendRepeatFunction() is specified then it is called without leading and trailing space.

Definition at line 532 of file IRSend.hpp.

◆ sendPulseDistanceWidth() [2/2]

void IRsend::sendPulseDistanceWidth ( uint_fast8_t  aFrequencyKHz,
unsigned int  aHeaderMarkMicros,
unsigned int  aHeaderSpaceMicros,
unsigned int  aOneMarkMicros,
unsigned int  aOneSpaceMicros,
unsigned int  aZeroMarkMicros,
unsigned int  aZeroSpaceMicros,
IRRawDataType  aData,
uint_fast8_t  aNumberOfBits,
bool  aMSBFirst,
bool  aSendStopBit,
unsigned int  aRepeatPeriodMillis,
int_fast8_t  aNumberOfRepeats,
void(*)()  aSpecialSendRepeatFunction = NULL 
)

Sends PulseDistance frames and repeats.

Parameters
aFrequencyKHz,aHeaderMarkMicros,aHeaderSpaceMicros,aOneMarkMicros,aOneSpaceMicros,aZeroMarkMicros,aZeroSpaceMicros,aMSBFirst,aSendStopBit,aRepeatPeriodMillisValues to use for sending this protocol, also contained in the PulseDistanceWidthProtocolConstants of this protocol.
aDatauint32 or uint64 holding the bits to be sent.
aNumberOfBitsNumber of bits from aData to be actually sent.
aNumberOfRepeatsIf < 0 and a aProtocolConstants->SpecialSendRepeatFunction() is specified then it is called without leading and trailing space.
aSpecialSendRepeatFunctionIf NULL, the first frame is repeated completely, otherwise this function is used for sending the repeat frame.

Definition at line 589 of file IRSend.hpp.

◆ sendPulseDistanceWidthData() [1/2]

void IRsend::sendPulseDistanceWidthData ( PulseDistanceWidthProtocolConstants aProtocolConstants,
IRRawDataType  aData,
uint_fast8_t  aNumberOfBits 
)

Sends PulseDistance data The output always ends with a space Each additional call costs 16 bytes program memory.

Definition at line 643 of file IRSend.hpp.

◆ sendPulseDistanceWidthData() [2/2]

void IRsend::sendPulseDistanceWidthData ( unsigned int  aOneMarkMicros,
unsigned int  aOneSpaceMicros,
unsigned int  aZeroMarkMicros,
unsigned int  aZeroSpaceMicros,
IRRawDataType  aData,
uint_fast8_t  aNumberOfBits,
bool  aMSBfirst,
bool  aSendStopBit 
)

Sends PulseDistance data The output always ends with a space.

Definition at line 655 of file IRSend.hpp.

◆ sendPulseDistanceWidthFromArray() [1/2]

void IRsend::sendPulseDistanceWidthFromArray ( PulseDistanceWidthProtocolConstants aProtocolConstants,
IRRawDataType aDecodedRawDataArray,
unsigned int  aNumberOfBits,
int_fast8_t  aNumberOfRepeats 
)

Sends PulseDistance data from array using PulseDistanceWidthProtocolConstants For LSB First the LSB of array[0] is sent first then all bits until MSB of array[0].

Next is LSB of array[1] and so on. The output always ends with a space Stop bit is always sent

Definition at line 460 of file IRSend.hpp.

◆ sendPulseDistanceWidthFromArray() [2/2]

void IRsend::sendPulseDistanceWidthFromArray ( uint_fast8_t  aFrequencyKHz,
unsigned int  aHeaderMarkMicros,
unsigned int  aHeaderSpaceMicros,
unsigned int  aOneMarkMicros,
unsigned int  aOneSpaceMicros,
unsigned int  aZeroMarkMicros,
unsigned int  aZeroSpaceMicros,
IRRawDataType aDecodedRawDataArray,
unsigned int  aNumberOfBits,
bool  aMSBFirst,
bool  aSendStopBit,
unsigned int  aRepeatPeriodMillis,
int_fast8_t  aNumberOfRepeats 
)

Sends PulseDistance data from array For LSB First the LSB of array[0] is sent first then all bits until MSB of array[0].

Next is LSB of array[1] and so on. The output always ends with a space Stop bit is always sent

Definition at line 383 of file IRSend.hpp.

◆ sendRaw() [1/2]

void IRsend::sendRaw ( const uint16_t  aBufferWithMicroseconds[],
uint_fast16_t  aLengthOfBuffer,
uint_fast8_t  aIRFrequencyKilohertz 
)

Function using an 16 byte microsecond timing array for every purpose.

Raw data starts with a Mark. No leading space as in received timing data!

Definition at line 278 of file IRSend.hpp.

◆ sendRaw() [2/2]

void IRsend::sendRaw ( const uint8_t  aBufferWithTicks[],
uint_fast16_t  aLengthOfBuffer,
uint_fast8_t  aIRFrequencyKilohertz 
)

Function using an 8 byte tick timing array to save program memory Raw data starts with a Mark.

No leading space as in received timing data!

Definition at line 303 of file IRSend.hpp.

◆ sendRaw_P() [1/2]

void IRsend::sendRaw_P ( const uint16_t  aBufferWithMicroseconds[],
uint_fast16_t  aLengthOfBuffer,
uint_fast8_t  aIRFrequencyKilohertz 
)

Function using an 16 byte microsecond timing array in FLASH for every purpose.

Raw data starts with a Mark. No leading space as in received timing data!

Definition at line 325 of file IRSend.hpp.

◆ sendRaw_P() [2/2]

void IRsend::sendRaw_P ( const uint8_t  aBufferWithTicks[],
uint_fast16_t  aLengthOfBuffer,
uint_fast8_t  aIRFrequencyKilohertz 
)

New function using an 8 byte tick timing array in FLASH to save program memory Raw data starts with a Mark.

No leading space as in received timing data!

Definition at line 354 of file IRSend.hpp.

◆ setSendPin()

void IRsend::setSendPin ( uint_fast8_t  aSendPin)

Definition at line 119 of file IRSend.hpp.

◆ space()

void IRsend::space ( unsigned int  aSpaceMicros)
static

Sends an IR space for the specified number of microseconds.

A space is "no output", so just wait.

Definition at line 927 of file IRSend.hpp.

◆ write()

size_t IRsend::write ( IRData aIRSendData,
int_fast8_t  aNumberOfRepeats = NO_REPEATS 
)

Interprets and sends a IRData structure.

Parameters
aIRSendDataThe values of protocol, address, command and repeat flag are taken for sending.
aNumberOfRepeatsNumber of repeats to send after the initial data if data is no repeat.
Returns
1 if data sent, 0 if no data sent (i.e. for BANG_OLUFSEN, which is currently not supported here)

Definition at line 155 of file IRSend.hpp.

Variable Documentation

◆ IrSender

IRsend IrSender

Definition at line 59 of file IRSend.hpp.