button-rgblcd

cesars/rgblcd/button-rgblcd

No description
button-rgblcd
@/button-rgblcd
initpulse
lcd@/rgblcd
button-rgblcd
init
lcd
button
up
down
left
right
select
selectpulse
rightpulse
leftpulse
downpulse
uppulse
buttonnumber
To use the node in your project you should have the cesars/rgblcd 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 {
};

{{ GENERATED_CODE }}

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

    // Get a pointer to the class instance
    auto lcd = getValue<input_lcd>(ctx);
    uint8_t buttons = lcd->readButtons();
    emitValue<output_button>(ctx, buttons);
    switch(buttons){
        case 8:
            emitValue<output_up>(ctx, 1);
            break;
        case 4:
            emitValue<output_down>(ctx, 1);
            break;
        case 10:
            emitValue<output_left>(ctx, 1);
            break;
        case 2:
            emitValue<output_right>(ctx, 1);
            break;
        case 1:
            emitValue<output_select>(ctx, 1);
            break;
    }
}