A newer version of Max is available. Click here to access the latest version of this document.

togedge

Report zero/non-zero transitions

Description

togedge sends bangs for 0-to-1 transitions out the left outlet, and bangs the right outlet for 1-to-0 transitions. Outlets alternate output when bangs are received.

Arguments

None.

Messages

bang Switches the value stored in togedge from 0 to non-zero, or vice versa, and reports the change by sending a bang out one of the outlets.
int input [int]
The number is stored in togedge. If it is not 0, and the previously stored number was 0, togedge sends a bang out the left outlet. If the number is 0, and the previously stored number was not 0, togedge sends a bang out the right outlet. Otherwise, togedge sends no output.

Information for box attributes common to all objects

Output

bang: Out left outlet: If the stored value is changed from 0 to not 0.

Out right outlet: If the stored value is changed from not 0 to 0.

Examples

Used as a detector of on/off status or to switch back and forth between two triggers

See Also

Name Description
change Filter out repetitions of a number
led Display on/off status in color
toggle Switch between off and on (0 and 1)