To use the node in your project you should have the dinosalvioni/kkmoontpa3116-2x50w 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
#pragma XOD require "https://github.com/z3t0/Arduino-IRremote"
{{#global}}
#include <IRremote.h>
{{/global}}
struct State {
IRsend* irsend;
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
State* state = getState(ctx);
auto irsend = state->irsend;
auto type = getValue<input_Type>(ctx);
auto value = getValue<input_CODE>(ctx);
auto bits = getValue<input_Bits>(ctx);
if (isInputDirty<input_UPD>(ctx)) {
emitValue<output_ACT>(ctx, true);
for (int i = 0; i < getValue<input_Repeat>(ctx); i++) {
if (type == NEC) {
irsend->sendNEC(value, bits);
}
else if (type == SONY) {
irsend->sendSony(value, bits);
}
else if (type == RC5) {
irsend->sendRC5(value, bits);
}
else if (type == RC6) {
irsend->sendRC6(value, bits);
}
else {
//Error
//Serial.print(label);
//Serial.println("Bad type!");
}
delay(getValue<input_Delay>(ctx));
}
emitValue<output_ACT>(ctx, false);
emitValue<output_DONE>(ctx, 1);
}
}