Inputs
Last updated
Last updated
The second option on the equation menu is "Input," as shown in image I. Clicking on the "input" icon will take you to the input menu, shown in image II.
There are two different kinds of inputs: inputs with discrete properties like buttons or gesture modules, and inputs that give a value, like distance or light.
Discrete inputs can be put into equations directly. Take the example equation: “When gesture is left, do this.”
In order to build this equation, we start with a 'when' statement, as shown in image III. We can then either tap on the words "this happens," or we can press the blue plus and then select 'input' to open the input menu.
Once in the input menu, tap gesture, as shown in image IV. You will see that Gesture has only 4 possible values it can return. For this example, we will select "left" and then tap the "add input" button at the bottom of the page, as shown in image V.
You will now see that we have the example equation, as shown in image VI.
Non-discrete inputs cannot be put into equations directly because unlike discrete equations, they don't return a clear truth value (e.g. pressed or not pressed; left, right, up, or down) unless they are compared to a value. Therefore, in order to add an input like distance to an equation, you need to compare the value of the distance, which is in millimeters, to some other value. Take the example equation "When millimeters of distance is greater than 1000, do this."
In order to build this equation, we start with a 'when' statement, just as with the last example. We can then either tap on the words "this happens," or we can press the blue plus and then select 'input' to open the input menu.
Once in the input menu, tap distance, as shown in image VII. You will see that distance has a comparison menu, comprising of a "comparison type" with four options that you can scroll through (less than, greater than, equal to, and between) and a variable. For this example, we will select "greater than" and then tap the "variable" button at the bottom, as shown in image VIII.
There will be two options that pop up for the variable: "Modules" and "Value," as shown in image IX For this example, we will tap "Value" and type in our desired value of 1000. Hit "Add Value."
Press "Add Input" and you will now have the example equation, as shown in image X.
What we have just done in this example equation is used a comparison. Comparisons occur between at least 2 variables, and the four types of comparison are: less than, greater than, equal to, or between, as shown in the example above. The variables in a comparison also fall into two categories: modules and values. Let's take a look at each one in turn.
Modules - When the variables are both modules, you are comparing the value of one module to the value of another. For example, “when distance is greater than proximity, do this.” There are options to normalize the modules to a 0-100 scale, as well as smoothing (taking an average to avoid spikes) them when you select them.
Values - The simplest variable in a compare - simply type in the number you want to compare. Let's imagine we want to measure when someone is coming through a door, and use that to trigger a light show. We can attach a Device to one side of the doorway, and trigger our light show every time that the distance is less than the width of the doorway, which let's imagine is 1500mm. Our equation becomes “when distance is less than 1500, do this.” Some modules have values that are normalized to a 0-100 scale, and for others it is helpful to either normalize them or to be familiar with the range of values it returns when selecting a value in a comparison. See module section for information about ranges of each module.