tick-tock

wkov/colony/tick-tock

No description
tick-tock
@/tick-tock
UPDpulse
Trigger to read new state.
tick-tock
MS
TICK
TOCK
UPD
TOCKpulse
Pulse when passing second half of second.
TICKpulse
Pulse when passing first half of second.
MSnumber
The current state from 0 to 999, in milliseconds.
To use the node in your project you should have the wkov/colony 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

#pragma XOD dirtieness disable

node {
    bool pos = false;

    void evaluate(Context ctx) {
        uint16_t ms = millis() % 1000;
        emitValue<output_MS>(ctx, ms);
        if (pos) {
            if (ms < 500) {
                emitValue<output_TOCK>(ctx, pos = false);
            }
        } else if (ms > 500) {
            emitValue<output_TICK>(ctx, pos = true);
        }
    }
}