nextion-serial-write

mendrig/nextion-lib/nextion-serial-write

Outputs an command to the Nextion display . Command will end with 0xff 0xff 0xff Serial2 is used!!!
nextion-serial-write
@/nextion-serial-write
Outputs an command to the Nextion display . Command will end with 0xff 0xff 0xff Serial2 is used!!!
LINEstring
Command for the Nextion display
DUMPpulse
nextion-serial-write
LINE
DUMP
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) {
    if (!isInputDirty<input_DUMP>(ctx))
        return;

    State* state = getState(ctx);
    if (!state->begun) {
        Serial2.begin(9600);
        state->begun = true;
    }

    auto line = getValue<input_LINE>(ctx);

    for (auto it = line->iterate(); it; ++it)
        Serial2.write((char)*it);
    Serial2.write(0xff);
    Serial2.write(0xff);
    Serial2.write(0xff);
    Serial2.flush();  // programm waits until all data is written to serial
}