Logic Gadgets: XOR gate

Name of gadget XOR gate
Section Logic & Processing
Number of Tweak pages 1
Author LadylexUK, QuietlyWrong
Last updated 22 Feb 2019


This gadget analyses two or more signals and produces a true signal if only one of them is true. You would use this to activate something when exactly one and ONLY one of a selection of conditions needs to be true for an action to happen. You can add up to 10 conditions to this gadget (see tips below if you need more).

The classic example use for the XOR gate is for a pair of light switches, one at each end of a flight of stairs. If you flick one of them, it will always change the number of true inputs between 1 (true) and [0 or 2] (both false) or vice versa, therefore allowing you to toggle a light on and off from either switch. (Note, however, that this won’t work well for three or more switches connected to the XOR gate. Can you see why? More tips below…)

Example Tutorial (adapted from Media Molecule)

  1. Place a light
  2. Place a controller sensor
  3. Place a trigger zone
  4. Place a puppet
  5. Place an XOR gate
  6. Connect detected on the trigger zone to the A input.
  7. Tweak the controller sensor and make it remote controllable
  8. Connect the square output on the controller sensor to the B port on the XOR gate.
  9. Connect the result output of the XOR gate to the power port on the light
  10. Go to test mode.
  11. Press the square button. The light will come on.
  12. Possess the puppet.
  13. Run into the trigger zone and the light comes on.
  14. Now try pressing the button while in the trigger zone. The light does not come on.

Tweak Menus

  1. No. of Ports
    1a. Input
    1b. Output
  2. Inputs
    2a. Input
  3. Result
    3b. Output
  4. Power
  1. No. of Ports
    Select how many inputs you are comparing here. The ports are activated in strict sequence from top to bottom, A to J.
  2. Inputs
    Wire your inputs into each port. An active port with no input will default to a “false” signal, though this is unimportant because one extra “false” signal won’t change the count of “true signals”.
  3. Results
    This will produce a signal of true (1) if one and only one of the attached inputs is true (1).
  4. Power
    This is where you can turn the gadget on/off

QW Tips

If you need to detect more than 10 conditions, consider using some tags, a trigger zone gadget and a calculator instead:

  • Use each condition to set whether a tag is active.
  • A trigger zone can return the number of tags it detects from its Number Detected output.
  • Make sure the trigger zone’s Number Required is more than 1 or you’ll end up with an OR gate!
  • Use a calculator to check whether this number is Equal To 1.

Coming back to the “multiple light switches” example mentioned in the introduction, if you want to have more than two switches, all of which can turn a light on and off, what you really need is an “odd number detector”. This can also be achieved with the above method, only you would use the calculator to check if the number of active tags leaves a remainder when divided by 2.

However a really neat trick is to wire 2 or more two-input XOR gates in sequence (they MUST be two-input only!) in the following manner (we’ll get a real Dreams screenshot once the Creator Early Access is available):

OR gates in sequence

… and you can repeatedly add new inputs by extending this pattern downwards, one XOR gate for each input. The output is true when the number of inputs is odd. If you can’t easily see why this works, try it out for yourself!

Useful Tutorials

Beginners guide to Logic Gates


Comments and Feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: