Previous topic

Bypassing with Switches

Next topic

Propagating Rates: streamRate

This Page

Latching a Switch

Reaction: Latch

reaction Latch {
        output:         Switch
        onExecution:    Reset
        terminateWhen:  Done
        internalBlock:  [
                switch Switch   { default: off reset: none },
                switch Done     { default: off reset: Reset },
                trigger Reset   {}
        ]
        streams:        [
                Switch >> Select ( whenOn: off whenOff: on ) >> Switch;
                on >> Done;
        ]
}

Rising Edges

                        x       x       |                       x       x       x       |
Button  x       x       |               x       x       x       |                       x       x

                        x       x       x       x       x       |
Latched x       x       |                                       x       x       x       x       x
switch Button {}
switch Latched {}

Button >> Latch () >> Latched;

Different Edges

                        x       x       |                       x       x       x       |
Button  x       x       |               x       x       x       |                       x       x

                        x       x       x       x       x       x       x       x       |
Latched x       x       |                                                               x       x
switch Button {}
switch Latched {}

Button >> OnEdge ( edge: [ 'Rising', 'Falling' ] ) >> Latch () >> Or () >> Latched;