Skip to content

Sending with the IRremote library

shirriff edited this page May 6, 2011 · 1 revision

The following example shows how to use the IRremote library to send an IR code. This example (from Examples > IRremote > IRsendDemo) will send a Sony TV power code three times when anything is received via the serial port. An infrared LED must be connected to pin 3. If you point the LED at an appropriate Sony TV, the TV should turn on or off.

#include <IRremote.h>
IRsend irsend;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
      irsend.sendSony(0xa90, 12); // Sony TV power code
      delay(100);
    }
  }
}

Clone this wiki locally