To use the node in your project you should have the stefanc1991/essentials-a 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
// based on https://xod.io/libs/ivanmason/lcd16x2x5button/updowncount/
#pragma XOD dirtieness disable
node {
// Internal state variables defined at this level persists across evaluations
Number count;
void evaluate(Context ctx) {
if(isInputDirty<input_Reset>(ctx)) {
count = getValue<input_Start>(ctx);
}
if(isInputDirty<input_Add>(ctx)){
count += getValue<input_Step>(ctx);
}
if(isInputDirty<input_Subtract>(ctx)){
count -= getValue<input_Step>(ctx);
}
if (count > getValue<input_Max>(ctx)) {
count = getValue<input_Max>(ctx);
}
if (count < getValue<input_Min>(ctx)) {
count = getValue<input_Min>(ctx);
}
emitValue<output_Count>(ctx, count);
emitValue<output_Done>(ctx, 1);
}
}