ir-receiver

thatoneguy/my-ir-sensor/ir-receiver

No description
ir-receiver
@/ir-receiver
INport
ir-receiver
IN
OUT
OUTbyte
To use the node in your project you should have the thatoneguy/my-ir-sensor library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#include <IRremote.hpp>


node {
    // Internal state variables defined at this level persists across evaluations
    Number foo;
    uint8_t bar = 5;

    void evaluate(Context ctx) {
        bar += 42;

        if (isSettingUp()) {
            // This run once
            auto pin = getValue<input_IN>(ctx);
            foo = (Number)(bar + 1);
            Serial.begin(115200);
            #define IR_RECEIVE_PIN pin
            //Serial.begin(115200); // // Establish serial communication
            IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
        }

        if (IrReceiver.decode()) {
          Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX); // Print "old" raw data
          IrReceiver.printIRResultShort(&Serial); // Print complete received data in one line
          IrReceiver.printIRSendUsage(&Serial);   // Print the statement required to send this data

          IrReceiver.resume(); // Enable receiving of the next value
        emitValue<output_OUT>(ctx, IrReceiver.decodedIRData.decodedRawData);
        }
    }
}