To use the node in your project you should have the bradzilla84/433mhz-rcswitch 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
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isInputDirty<input_INIT>(ctx))
return;
if (isSettingUp()){
auto state = getState(ctx);
auto rcswitch = getValue<input_IN>(ctx);
rcswitch->enableReceive(getValue<input_interrupt>(ctx)); // Receiver on interrupt 0 => that is pin #2
}
auto state = getState(ctx);
auto rcswitch = getValue<input_IN>(ctx);
if (rcswitch->available()) {
Number result = Number(rcswitch->getReceivedValue());
emitValue<output_Value>(ctx, result);
emitValue<output_Bitlength>(ctx, rcswitch->getReceivedBitlength());
emitValue<output_Delay>(ctx, rcswitch->getReceivedDelay());
emitValue<output_Rawdata>(ctx, *rcswitch->getReceivedRawdata());
emitValue<output_Protocol>(ctx, rcswitch->getReceivedProtocol());
emitValue<output_Rec>(ctx, 1);
rcswitch->resetAvailable();
}
emitValue<output_OUT>(ctx, rcswitch);
}