Delays triggering of an incoming pulse by specified time
delay
@/delay
Delays triggering of an incoming pulse by specified time
ACTboolean
Outputs true when delay is in progress
DONEpulse
Pulses once the delay is over
node {
void evaluate(Context ctx) {
if (isInputDirty<input_RST>(ctx)) {
clearTimeout(ctx);
emitValue<output_ACT>(ctx, false);
} else if (isInputDirty<input_SET>(ctx)) {
TimeMs dt = getValue<input_T>(ctx) * 1000;
setTimeout(ctx, dt);
emitValue<output_ACT>(ctx, true);
} else if (isTimedOut(ctx)) {
emitValue<output_DONE>(ctx, true);
emitValue<output_ACT>(ctx, false);
}
}
}
__time(ms) | T | SET | RST | DONE | ACT |
---|
0 | 0.5 | no-pulse | no-pulse | no-pulse | false |
1000 | 0.5 | pulse | no-pulse | no-pulse | true |
1500 | 0.5 | no-pulse | no-pulse | no-pulse | true |
1501 | 0.5 | no-pulse | no-pulse | pulse | false |
2000 | 0.5 | pulse | pulse | no-pulse | false |
2500 | 0.5 | pulse | no-pulse | no-pulse | true |
2600 | 2 | no-pulse | no-pulse | no-pulse | true |
2700 | 2 | no-pulse | pulse | no-pulse | false |
3001 | 2 | no-pulse | no-pulse | no-pulse | false |