widget-led

greenberg-nicholas/esp32-relay/widget-led

Writes data to a blynk LED widget
widget-led
@/widget-led
Writes data to a blynk LED widget
BLNK@/blynk
VPINnumber
Virtual pin number of a LED widget
CLRstring
A color value
PUSHpulse
Triggers a new write
INITpulse
Initializes a widget
widget-led
BLNK
VPIN
CLR
PUSH
INIT
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 {
    char color[10];
};

{{ 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_INIT>(ctx)){
        uint8_t vpin = getValue<input_VPIN>(ctx);
        blynk.xodBlynk->virtualWrite(vpin, 255);
    }


    if (isInputDirty<input_PUSH>(ctx)){
        dump(getValue<input_CLR>(ctx),state->color);
        blynk.xodBlynk->setProperty(vpin,"color",state->color);
    }
}