write-string

wayland/nextion/write-string

Write to the string attribute of an object.
write-string
@/write-string
Write to the string attribute of an object.
DEV@/nextion-serial
A nextion device.
CMDstring
Command. Specify object and attribute to be written. For example, t0.txt will overwrite the text attribute of the object named t0.
TEXTstring
String to be written.
UPDpulse
Update.
write-string
DEV
CMD
TEXT
UPD
Done
Donepulse
Pulse on write.
To use the node in your project you should have the wayland/nextion 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

node {
    void evaluate(Context ctx) {
        // The node responds only if there is an input pulse
        if (!isInputDirty<input_UPD>(ctx))
            return;

        // Get a pointer to the `EasyNex` class instance
        auto eznex = getValue<input_DEV>(ctx);
        auto xStringCmd = getValue<input_CMD>(ctx);
        auto xStringText = getValue<input_TEXT>(ctx);

        int N=length(xStringCmd) + 1;
        char cStringCmd[N];
        for(int i=0;i<N;i++)
            cStringCmd[i]=0;
        dump(xStringCmd, cStringCmd);

        N=length(xStringText) + 1;
        char cStringText[N];
        for(int i=0;i<N;i++)
            cStringText[i]=0;
        dump(xStringText, cStringText);

        eznex -> writeStr(cStringCmd, cStringText);
        emitValue<output_Done>(ctx, 1);
    }
}