Right now I'm making a pumpkin/melon harvester, and I'm running across a problem I've faced in similar situations before. It has a row of melon and pumpkin seeds on either side of it, and a circuit which has parts fire at specific times.
I activate the circuit when the inner blocks are filled with pumpkins and melons. When I do that, three things happen.
1. The sticky pistons with glass blocks extend, covering the stems.
2. After a three-tick delay, the blocks the crops were on are pushed up with sticky pistons, breaking them.
3. After an additional two-tick delay, the pair of pistons open up, releasing water and pushing the drops toward me.
When I turn off the circuit, this happens:
1. The sticky pistons with glass retract, exposing the stems again.
2. After the three-tick delay, the blocks the crops were on are pulled back down.
3. After another two-tick delay, the water source blocks are closed off by the piston arms, preventing them from flowing.
The problem I am having is during deactivation. The flowing water doesn't disappear before steps one and two, causing it to flood the stems and destroy them.
The only solution I can think of is to have the pistons which handle the water close first during the deactivation sequence. But I don't know how I would go about doing that. I'm thinking I might need a latch or flip-flop attached to an extra branch that determines which side of the circuit is activated first. For activation go glass to water, and for deactivation go water to glass. But surely there's a different way?