write-number

wayland/nextion/write-number

Write to a numeric attribute of an object.
write-number
@/write-number
Write to a numeric attribute of an object.
DEV@/nextion-serial
A nextion device.
CMDstring
Command. Specify object and attribute to be written. For example, va0.val will overwrite the value attribute of the object named va0.
VALnumber
Number to be written.
UPDpulse
Update.
write-number
DEV
CMD
VAL
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 xString = getValue<input_CMD>(ctx);
        int N=length(xString) + 1;
        char cString[N];
        for(int i=0;i<N;i++)
            cString[i]=0;
        dump(xString, cString);
        uint32_t val = getValue<input_VAL>(ctx);
        eznex -> writeNum(cString, val);
        emitValue<output_Done>(ctx, 1);
    }

}