I have an iron door on the first floor (to the outside) of my tower. I tried to put a switch on both sides of the door so it can be opened from the inside and the outside. My problem is that because the switch has an "On" and "Off" if I open the door from the outside I need to turn "On" the switch on the inside, go back outside and turn "Off" that switch, just to run back inside and turn "Off" the inside switch to finally get the door to close. This is a giant pain in the rear when I have mobs chasing me to the door.

Is there any way to use switches to open and close the door no matter their position? Or would it be easier to use a button and just run through the door and have it close behind me automatically?


3 Answers 3


Buttons would certainly solve that problem, but you could also use an XOR gate between two switches which is how two-way switches work in the real world.

XOR Truth Table

  A  |  B  |   C 
  0  |  0  |   0
  0  |  1  |   1
  1  |  0  |   1
  1  |  1  |   0

As you can see, if either A or B changes (either of your switches), C (the output--your door) will as well.

There are a bunch of these on the YouTubes, but here is one that operates a set of double-doors:

  • 3
    Your truth table is for XNOR.
    – user9983
    Aug 24, 2011 at 15:50
  • That is excellent! I will use a button as a quick fix while I work on this. Thank you Nick T!
    – Adanion
    Aug 24, 2011 at 16:04

Use a button. It's far easier and you won't need to worry about closing the door behind you. On my SMP server I've had problems with people leaving doors "open" so I place a button on the outside to get in, and a pressure plate on the inside to allow for easy exits.


You can use an XOR like Nick said, or you can opt to use something called a T Flip-flop. Basically, that's a fancy way to say toggle button.

Just build one and connect a button to it, then route the output to the door. The advantages? You can connect as many buttons to one T Flip-flop as you want and they'll still always toggle the output. They're also really easy to build if you know the most compact design. You can find many designs on the wiki, or you can just go with this diagram of two compact ones:

enter image description here

Take your pick!

  • excellent! and if you include a reset switch you can add pressure plates to make sure the door closes behind the player
    – Zommuter
    Aug 26, 2011 at 5:03

Not the answer you're looking for? Browse other questions tagged .