To use the node in your project you should have the mendrig/nextion-lib 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
{
bool begun;
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
//auto inValue = getValue<input_IN>(ctx);
if (!isInputDirty<input_DUMP>(ctx))
return;
State* state = getState(ctx);
if (!state->begun)
{
Serial2.begin(9600);
state->begun = true;
}
Number Check = 255;
if (Serial2.available())
{
Check = 1;
emitValue<output_DATA>(ctx, true);
}
else
{
Check = 0;
emitValue<output_DATA>(ctx, false);
}
//emitValue<output_OUT>(ctx, inValue);
emitValue<output_CHECK>(ctx, Check);
emitValue<output_DONE>(ctx, true);
}