How to have the door stay open until I go go back inside

starbound

I want to have a pressure plate beside my door on the inside. When I step on it I want it to toggle my door open or closed. So if I walk out my door should stay open until I (or someone else) walks back inside.

Best Answer

I was able to rig together something that accomplishes this using two Not gates, and two Latches. I'm using a button for input (because it's what I had on me), but a pressure plate's behavior won't be any different, since nothing is based on careful timing.

Image of the wiring

The layout is a bit spread apart to illustrate how it works, and can certainly be rearranged and compacted a fair bit when put into actual use.

The two on the bottom are the Nots, the two on top the Latches. Basically, the latch on the left always has an input of Not(output from the right), and the latch on the right feeds input from the latch on the left. The left latch's top input is Not(the button), and the right latch's top input is the button itself. The right latch outputs to the door.

While the button is off, this leaves the left latch free to update with the state the door should take on the next press. The latch on the right, however, can't update until the button is pushed. When that happens, the right latch takes on the new value from the left latch, toggling the door. The left latch, however, can't update until the button turns off, at which point it'll grab the new state for the next toggle.