count-my

sergtzar67/program-clock-v01/count-my

No description
count-my
@/count-my
RSTpulse
Resets the accumulated value to zero.
STEPnumber
Value to add on each increment. Use a negative value (e.g. -1) to make decrements.
INCpulse
Triggers a single increment.
count-my
OUT
RST
STEP
INC
OUTnumber
The accumulated value.
To use the node in your project you should have the sergtzar67/program-clock-v01 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) {
    uint32_t count = getValue<output_OUT>(ctx);

    if (isInputDirty<input_RST>(ctx))
        count = 0;
    else if (isInputDirty<input_INC>(ctx))
        count += getValue<input_STEP>(ctx);

    emitValue<output_OUT>(ctx, count);
}