Combine

Processes up to four inputs and outputs the min, max, sum, difference, etc. of those inputs

The Combine widget is used to combine the values coming from several widgets into a single output. For example, if you have four light sensors, their outputs can be combined and read by a single VideoControl widget. If you want a video to play when any of the sensors sees bright light, you would use four AnalogIn widgets for the light sensors. Then set the Combine widget to listen to all four of the AnalogIns. With the Combine widget set to MAX, the highest value of any of the inputs will be output to VideoControl. When any of the four light sensors has a light is on it, the single output of the Combine widget will reflect that highest value. The VideoControl widget would be set to listen to the output of the Combine widget and trigger the play of a video when any of the light sensors detects bright light.

In addition to the MAX setting, there are options for MIN, ALL, subtract “-“, add “+”, multiply “*”, divide “/”, and average “avg”. All of these will perform their operations on all the inputs set in the parameters (if you leave an input parameter set to “none”, this input will be ignored).

There is also a “change” option, which will operate only on the first input. The change setting outputs the difference between the current input value and the previous input value. This can be used to see the amount of change in an input. For example, if you are turning a knob, this value will indicate the speed and direction (negative or positive) of the knob turn rather than the absolute position of the knob.

AnalogIn0 -> \
AnalogIn1 —> \
AnalogIn2 —–> \
AnalogIn3 ——> \ -> Insert -> VideoControl

On Screen Features

  • OUT: The output value determined by the Combine setting
  • SETTING: This determines what happens when the inputs are combined (any inputSource set to “none” will be ignored)
    • MAX: Outputs the highest value from any of the inputs
    • MIN: Outputs the lowest value from any of the inputs
    • ALL: Outputs inputs from all of the inputs, whichever one was last received
    • “-“: Subtracts the second from the first, then the third , and then fourth
    • “+”: Adds all of the inputs together
    • “*”: Multiplies all of the inputs together
    • “/”: Divides the second from the first, then the third , and then fourth
    • AVG: Outputs the average of all the inputs, e.g. (first + second + third + fourth) / 4
    • CHANGE: For the first input only, outputs the difference between the current input and the previous input.

Parameters

  • ABSOLUTE VALUE: If set, forces the output to be a positive number. For example, if the subtract or change settings are used, they can produce negative numbers. Using this setting will change those negative numbers into positive numbers at the output.
  • CHANGE MAX: For the change setting only, any amount of change (negative or positive) that greater than this setting will be ignored, and the previous amount of change will be used. This is most useful if the sensor is a 360 degree knob with no stop, where the values change from 1023 to 0 as the knob rotates past the maximum value possible on the knob. For example, the new value might be 10, and the last value was 1020. Therefore, the output would normally be -1010, but would be ignored if the changeMax is set to a lower number such as the default of 500.
  • INPUT SOURCE: the instance name of the source first the widget listens to, e.g AnalogIn or DigitalIn.
  • INPUT SOURCE1: second input
  • INPUT SOURCE2: third input
  • INPUT SOURCE3: fourth input
  • INVISIBLE: if set to “yes”, the widget will disappear when the Flash movie is run

Last modified March 5th, 2012