read

greenberg-nicholas/esp32-relay/read

Reads data from a blynk widget
read
@/read
Reads data from a blynk widget
BLNK@/blynk
VPINnumber
Virtual pin number of a widget
READpulse
Triggers a new read
read
BLNK
VPIN
READ
DATA
DATAstring
The last read data
To use the node in your project you should have the greenberg-nicholas/esp32-relay 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 {
    CStringView view;
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto state = getState(ctx);
    auto _blynk = getValue<input_BLNK>(ctx);
    uint8_t vpin = getValue<input_VPIN>(ctx);

    if (isInputDirty<input_READ>(ctx)){
        if (vpin == _blynk.vpin){
            state->view = CStringView(_blynk.vpinData);
            emitValue<output_DATA>(ctx, XString(&state->view));
        }
    }
}