Icon | ![]() |
---|---|
Name of gadget | AND gate |
Section | Logic & Processing |
Number of Tweak pages | 1 |
Author | LadylexUK, QuietlyWrong |
Last updated | 22 Feb 2019 [Beta] |
Description
This gadget analyses two or more signals and produces a positive signal if all of them are true. You would use this to activate something when more than one condition needs to be true before an action happens, for example having to weigh down two buttons together to open a door. You can add up to 10 conditions to this gadget. If you need more than 10, see the tips below.
Example Tutorial (adapted from Media Molecule)
- Place an AND gate
- Place a controller sensor
- Stamp a cube
- Tweak the controller sensor and make it remote controllable
- Connect the outputs of cross and square to the input ports of the AND gate
- Connect the AND gate result output to the visible toggle on the cube
- Hit start time.
- Press the cross, then the square and then both of them together, you will notice the cube only appears when you press both buttons together.
Tweak Menus
![]() |
|
- No. of Ports
Select how many inputs you are going to add here. The ports become active in strict sequence from top to bottom, A to J.
Note that it is important to wire up each active input, because a port without an input wire will default to “false”, therefore the AND gate could never output a “true” signal in this state. - Inputs
Wire your inputs into each port. - Result
This will produce a signal of false (0) if ANY of the active inputs is false (0) and a signal of true (1) if ALL the active inputs are true (1). Even if you have 9 true signals and 1 false signal, this will still output false. - Power
This is where you can turn the gadget on/off.
QW Tips
If you need to detect more than 10 conditions, you could use a few AND gates together. Put the first 10 into one AND gate, the next 10 into another AND gate, and so on until you have one signal for each group of 10. Then you wire the outputs of each AND gate into another AND gate and the Result from that will be the required output. This would allow you to go up to 100 conditions and in theory you could have any number by nesting group after group of AND gates like this.
However… You should also consider using some tags and a trigger zone gadget instead. Use the completion of each condition to activate a tag and then use the trigger zone to determine whether all the tags are on (using the Number Required setting of the trigger zone). In this scenario, all of your tags will need to have the same name, specific to this one requirement.
Another-nother way of finding AND for a whole ton of inputs is to plug them all into one calculator’s A-input, with the “blend” wire blend mode (this averages the values). So then if all of them are 1, then the average will be 1. And if any one of them are not 1, the average will be less than 1. So use the calculator to check if the value is 1, and use that resulting output as the AND for all those inputs.
Depends on the situation, but “blending” wires is super useful for a lot of things ;P
LikeLike