To use the node in your project you should have the gabbapeople/esc 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/RB-ENantel/RC_ESC"
{{#global}}
#include <ESC.h>
{{/global}}
struct State {
uint8_t mem[sizeof(ESC)];
ESC* myESC;
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
State* state = getState(ctx);
if (isInputDirty<input_INIT>(ctx)){
auto port = (int)getValue<input_PORT>(ctx);
state->myESC = new (state->mem) ESC(port,1000,2000,500);
state->myESC->arm();
delay(5000);
}
if (isInputDirty<input_UPD>(ctx)){
int speedVal = getValue<input_SPD>(ctx);
state->myESC->speed(speedVal);
}
}