Guides

How to Use Logic Gates

Truth-table style wiring for doors, turrets and repeating timers — the deep how-to next to our controllers overview.

Last updated:

Logic gates vs the controllers overview

The controllers and sensors page covers the whole wiring ecosystem. This guide is the hands-on logic-gate workbook: what each of the six modes does, how the Connect Tool directions matter, and three circuits you can build in Creative before copying them into Survival.

Patch 1.0.5 restored reliable welding onto bearings, suspensions and pistons — required for most automated mounts that sit on joints. Update Steam if your turret or piston door refuses to weld; see updates.

The six gate modes

Every Logic Gate block processes ON/OFF inputs and lights its face when the output is ON:

ModeOutput is ON when…
ANDEvery linked input is ON
ORAt least one input is ON
XORAn odd number of inputs are ON
NANDNOT AND — off only when all inputs are on
NORNOT OR — on only when every input is off
XNORInputs match (all on or all off / even parity depending on fan-in)

Interact with the block to cycle modes. The glyph on the face shows the active mode.

Connect Tool direction matters

  1. Equip the Connect Tool (default C in most binds — confirm on controls).
  2. Click the source (button, switch, sensor, timer, or another gate).
  3. Click the destination (the gate that should receive the signal, then the piston, bearing or light).

Wiring from A to B means A drives B. Reverse the order and your door logic will feel inverted. Gates have a one-tick delay (~0.025 s), which is why timer loops need a deliberate clock design rather than a single self-wire.

Circuit 1 — Two-switch XOR door

Useful for a door that toggles from either cockpit button without needing both pressed:

  1. Place Switch A, Switch B and one Logic Gate set to XOR.
  2. Connect A → XOR, B → XOR.
  3. Connect XOR → door controller or piston.

Flip either switch alone to open; flip the second to close (parity flips again).

Circuit 2 — Repeating timer clock

Parts: 3 Logic Gates, 1 Timer, 1 Switch (matches the common community pattern shown in the embedded video).

  1. Gate 1 = OR, Gate 2 = XNOR, Gate 3 = AND.
  2. Wire OR → XNOR → AND → Timer → back to OR (loop).
  3. Wire the Switch into the OR so you can disable the clock.
  4. Take the output from XNOR (or AND, depending on blink preference) to a light, Spud Gun trigger or conveyor tilt.

Tune the Timer duration for blink rate. This clock drives farm sorters and warning beacons without holding a button.

Circuit 3 — Sensor AND safety interlock

Keep a turret from firing while you stand in the kill zone:

  1. Motion sensor covering the yard → AND input 1.
  2. Cockpit switch (armed) → AND input 2.
  3. AND → Spud Gun / Sawbot trigger on a bearing mount.

Both “target present” and “armed” must be true. Combine with patterns from controllers and sensors.

Memory and latches

Looping NOR and OR gates can store a state (simple SR-style latch). Use latches when a single button press should keep a hangar door open until a second press closes it. Name every gate in the wiring UI before the nest grows past ten blocks.

Survival tips

  • Prototype clocks in Creative Mode, then import via the Scrap City Garage.
  • Keep batteries within a few blocks of sensor-heavy logic.
  • After 1.0.5, re-weld any jointed automation that failed during the 1.0.4 regression.

Watch the community walkthrough for this guide:

Easy repeating timer build tutorial — Scrap Mechanic logic
FAQ

Frequently Asked Questions

Quick answers to the most common questions.

Why does my gate stay stuck ON?

Usually a feedback loop without a disable switch, or inverted Connect Tool order. Add a switch into an OR/AND stage and reverse one connection if the face stays lit with all inputs off.

Can logic gates make computers?

Yes — community builders chain latches into ALUs. Start with clocks and doors before attempting memory banks; tick delay adds up quickly.

Do logic gates use battery power?

They draw negligible power compared with thrusters, but sensors and timed loops still expect a nearby battery on large Survival builds.