Logic gates are commonly used in electronics and programming to represent the flow from input to output where "truthiness" is assessed. Logic gates are always binary, regardless of input, in that they can be either true or false, but no other state.
Truthiness?
Truthiness, or truthfulness, or any other variation on true/false, is a colloquial term used within programming to communicate that a boolean (binary) assessment of an input is being made. In our case with Reactor this is to determine if the true or false state of the statement after looking at the state of the input sources, such as a device state.
Reactor's logic gates
Reactor using 4 of the logic gate options, NOT, AND, OR, and XOR. It also supports a NUL option which is used as a special case. The table below describes the gates and shows a truth table explaining how the logic is assessed. In this table a 0 represents false and 1 represents true.
For the sake of simplicity, the table below shows only 1 or 2 inputs per gate. In Reactor, it is possible to combine more than 2 items and assess all of them to determine the output.
Gate | Description | Truth Table | ||||||||||||||||||
NOT |
NOT gates are the same as an inverter, flipping the output opposite to the input. If the input to a NOT gate is TRUE then the output will be FALSE. Example: If the porch light (A) is on, this will evaluate as false, if the porch light is off, this will evaluate as true. |
|
||||||||||||||||||
AND |
AND gates assess the combined state of the inputs, all inputs must be TRUE for the output to evaluate as TRUE. For all other combinations, it will evaluate as false. Example: If the porch light (A) is on, and the front door sensor is not triggered (B) this will evaluate as true. If either of these devices changes state it will evaluate as false. |
|
||||||||||||||||||
OR |
OR gates will evaluate as true if any of the inputs are true, regardless of the state of any other input. Example: If the porch light (A) is on, and the front door sensor is not triggered (B) this will evaluate as true. If the porch light (A) is off, and the front door sensor is not triggered (B) this will evaluate as true. If the porch light (A) is off and the front door sensor is triggered (B) this will evaluate as false. |
|
||||||||||||||||||
XOR |
XOR gates are similar to OR gates except that they will only evaluate as true if ONE input is true. Example: If the porch light (A) is on, and the front door sensor is not triggered (B) this will evaluate as false. If the porch light (A) is off, and the front door sensor is not triggered (B) this will evaluate as true. If the porch light (A) is off and the front door sensor is triggered (B) this will evaluate as false. |
|