Set protocol (default is 1, will work for most outlets)
Repeatnumber
Number of times to repeat
Lenghtnumber
Number of times to repeat
UPDpulse
SEND
DONEpulse
Sent OK
To use the node in your project you should have the dinosalvioni/rf433 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/sui77/rc-switch"
{{#global}}
#include <RCSwitch.h>
{{/global}}
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isInputDirty<input_UPD>(ctx))
return;
//RCSwitch mySwitch = RCSwitch()
RCSwitch mySwitch;
if (isSettingUp()){
RCSwitch mySwitch = RCSwitch();
//Serial.begin(9600);
}
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(getValue<input_PIN>(ctx));
// Optional set pulse length.
mySwitch.setPulseLength(getValue<input_Lenght>(ctx));
// Optional set protocol (default is 1, will work for most outlets)
mySwitch.setProtocol(getValue<input_Protocol>(ctx));
// Optional set number of transmission repetitions.
mySwitch.setRepeatTransmit(getValue<input_Repeat>(ctx));
mySwitch.send(getValue<input_CODE>(ctx), getValue<input_Bit>(ctx));
//auto inValue = getValue<input_IN>(ctx);
//emitValue<output_OUT>(ctx, inValue);
emitValue<output_DONE>(ctx, 1);
}