CNAP

IR Receiver Reference

An infrared receiver module (e.g. TSOP38238) that demodulates IR remote signals into a digital pulse train on its data pin. Pair it with the IR Remote in the simulator to send codes.

Pin names

NameDescription
GNDGround
VCCPower (5V)
DATData — decoded IR signal, connect to any digital pin

Attributes

This component has no configurable attributes.

Usage

Connect VCC to 5V, GND to GND, and DAT to a digital pin. Decode signals with the IRremote library.

#include <IRremote.hpp>

const int IR_PIN = 2;

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

void loop() {
  if (IrReceiver.decode()) {
    Serial.print("Code: 0x");
    Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);
    IrReceiver.resume();
  }
}

Examples

DescriptionAttrs
Default IR receiver{}

See also

  • IR Remote — pairs with this receiver to send codes in the simulator