u8-count-limit

nazarijtipusak080/prototype-relay/u8-count-limit

No description
u8-count-limit
@/u8-count-limit
STEPbyte
limitebyte
INCpulse
Triggers a single increment.
RSTpulse
Resets the accumulated value to zero.
u8-count-limit
OUT
STEP
limite
INC
RST
DONE
DONEboolean
OUTbyte
To use the node in your project you should have the nazarijtipusak080/prototype-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

node {
    void evaluate(Context ctx) {
        uint8_t count = getValue<output_OUT>(ctx);
        uint8_t limit = getValue<input_limite>(ctx);
              if (isInputDirty<input_RST>(ctx))
       {count = 0; emitValue<output_DONE>(ctx, false);}
        else  if (count >= limit)
       { emitValue<output_DONE>(ctx, true); }
         else if (isInputDirty<input_INC>(ctx))
            count += getValue<input_STEP>(ctx);
         if(getValue<output_DONE>(ctx))
            count = 0;
        emitValue<output_OUT>(ctx, count);
    }
}