Remote Rx Sample

This application demonstrates decoding NEC protocol IR messages and prints decoded messages to Arduino IDE's Serial Monitor.

To run the example:

  1. Open the IoT_Node_IRRemote_Rx sketch from the examples menu.

  2. Select Turta IoT Node from the Tools > Board menu.

  3. Select your device's COM port from Tools > Port menu.

  4. Open Serial Monitor from Tools > Serial Monitor.

  5. Select 115.200 baud from the Serial Monitor's status bar.

  6. Upload the code to your device.

Sample Code

IoT_Node_IRRemote_Rx.ino
IoT_Node_IRRemote_Rx.ino
#include <Turta_IRRemote_Module.h>
#define LED 13
// Create IR Remote Module instance.
Turta_IRRemote_Module ir;
void setup() {
// Initialize onboard LED.
pinMode(LED, OUTPUT);
// Initialize IR Remote Module.
ir.begin();
ir.setReception(true);
// Configure serial port.
Serial.begin(115200);
delay(200);
}
void loop() {
if (ir.isMessageReceived()) {
digitalWrite(LED, HIGH);
byte dt[4] = {0};
ir.getData(dt[0], dt[1], dt[2], dt[3]);
Serial.print(dt[0]);
Serial.print(" ");
Serial.print(dt[1]);
Serial.print(" ");
Serial.print(dt[2]);
Serial.print(" ");
Serial.println(dt[3]);
digitalWrite(LED, LOW);
}
// Delay 10ms.
delay(10);
}

Result

After the application is uploaded to the device, it listens for the NEC protocol IR messages. When a message is decoded, the application prints it "to the Serial Monitor, and blinks the onboard LED. The example output should be like this:

0x20 0x21 0x22 0x23

The application runs forever until you clear it from memory.