1to6-pulse-dispenser-with-overflow

bjbaylon/utilities-for-menus/1to6-pulse-dispenser-with-overflow

A patch to assign an input pulse to one of six pssible outputs with overflow option to chain more dispensers.
1to6-pulse-dispenser-with-overflow
@/1to6-pulse-dispenser-with-overflow
A patch to assign an input pulse to one of six pssible outputs with overflow option to chain more dispensers.
INpulse
The input pulse to be send to one of the outputs.
IDXnumber
Index number to select the output that will transmit the IN pulse.
1to6-pulse-dispenser-with-overflow
IN
OUT1
OUT2
OUT3
OUT4
OUT5
OUT6
OVR
IDX
OVRnumber
Output of overflow (IDX - 6) count to additional pulse dispensers.
OUT6pulse
Pulse out when there is a pulse on IN and IDX = 6.
OUT5pulse
Pulse out when there is a pulse on IN and IDX = 5.
OUT4pulse
Pulse out when there is a pulse on IN and IDX = 4.
OUT3pulse
Pulse out when there is a pulse on IN and IDX = 3.
OUT2pulse
Pulse out when there is a pulse on IN and IDX =2.
OUT1pulse
Pulse out when there is a pulse on IN and IDX = 1.
To use the node in your project you should have the bjbaylon/utilities-for-menus 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) {
    int index = getValue<input_IDX>(ctx);

    emitValue<output_OVR>(ctx, (index - 6));
    
    if (index < 0){
        return;
    }
    
     if (isInputDirty<input_IN>(ctx)){
        switch (index) {
            case 0:
                break;
            case 1:
                emitValue<output_OUT1>(ctx, true);
                break;
            case 2:
                emitValue<output_OUT2>(ctx, true);
                break;
            case 3:
                emitValue<output_OUT3>(ctx, true);
                break;
            case 4:
                emitValue<output_OUT4>(ctx, true);
                break;
            case 5:
                emitValue<output_OUT5>(ctx, true);
                break;
            case 6:
                emitValue<output_OUT6>(ctx, true);
                break;
        }
     }
}