Minecraft – How to alternate redstone signal

minecraft-java-editionminecraft-redstone

I want to create a circuit that when a button is pushed, one piston goes after a delay from another piston, but when the button is reset (i.e. when it is released), then the same piston retracts first and then the second piston retracts later.

Best Answer

If I understand you right, you want an "ABBA circuit": When you turn the input on, first A turns on and then B, when you turn the input off, first B turns off and then A.

The Minecraft wiki lists multiple designs for those here: https://minecraft.gamepedia.com/Mechanics/Redstone/Miscellaneous_circuits#ABBA_circuit (archive)
More can be found online.

An easy example is this one, using the locking feature of repeaters: