Redstonery
RedstoneryCircuits › Piston T flip-flop
Memory circuit

Piston T flip-flop

Use a mechanical arrangement to store one changing bit.

5 × 1 footprint1 layer5 blocksTested in 4 rotationsJava Edition 26.2
Open in the simulatorBuild it in the game

Layout

Layer 0 (on the floor)
note block [instrument=basedrum] at x 0, z 0observer [facing=west] at x 1, z 0redstone dust at x 2, z 0sticky piston [facing=east] at x 3, z 0gold block at x 4, z 0
redstone dustinputpistonobservermoved or marker blockarrows point where a device sends its output; north is up

How it works

Construction generates an initial observer pulse; after 10 game ticks the gold block rests away from the piston. Then click the note block once to change its note: each short observer pulse alternately pulls the gold block home or leaves it out. Each accepted note change toggles the retained position. This uses note state changes, not simulated sound.

  1. Construction creates an initial observer pulse. Advance 10 game ticks after Reset so the gold block settles away from the piston.
  2. Each later note-block click changes its note state and creates a short observer pulse. The sticky piston alternately pulls the block home and leaves it away.

Inputs and outputs

  • Inputclick note block once (x 0, y 0, z 0)
  • Outputgold block home (x 4, y 0, z 0)
  • Outputgold block away (x 5, y 0, z 0)

Blocks you need

1 × note block, 1 × observer, 1 × redstone dust, 1 × sticky piston, 1 × gold block.

Build it in the game: 5 commands

Relative to where you stand, with x running east and z running south. Paste one line at a time into chat, or into a chain of command blocks. The block art is the game's own; the layout is what the page above shows.

setblock ~0 ~0 ~0 minecraft:note_block[instrument=basedrum]
setblock ~1 ~0 ~0 minecraft:observer[facing=west]
setblock ~2 ~0 ~0 minecraft:redstone_wire
setblock ~3 ~0 ~0 minecraft:sticky_piston[facing=east]
setblock ~4 ~0 ~0 minecraft:gold_block