How can I control a sequence of outputs via a single input?
Ok, so I’m making a map which needs a level system. By level system I mean:
- Push the button first time,output A lights up.
- Push the button second time,output B lights up.
- Push the button third time,output C lights up.
- And so on.
Essentially, each button press makes the next output in the sequence activate.
2 Solutions collect form web for “How can I control a sequence of outputs via a single input?”
As far as I understand your question, you want the first button to light A up, the second to light B up but only if A is on, and the third to light C up but only if B is on.
Basically you need to make three T-flip flops. A flip-flop is basically a single on/off memory which is swapped every time you power the input.
ie if it’s on and you power it, it goes off. If it’s off and you power it, it goes on.
For the first output, A, you only need to use the button to power the flip flop and A will change.
For the second output, B, you need to build an AND gate (you can find various tutorials on this) which has two inputs. The first comes from the output from A, the second from the button, and the output goes to the flip flop which changes the state of B.
The third output, C, is the same as B but uses the third button and B’s output instead of A’s output.
This will allow you to light the outputs up in the order A->B->C, but will mean you need to turn the outputs off again using C->B->A. You could reverse this, but I won’t over-complicate this answer with the method for that. You could, however, simply turn all 3 back off again by powering all three flip flops again manually with a 4th button.
You have three basic options as shown below:
First you have a hopper/dropper chain, next a piston and block ribbon, and finally, a T flip-flop counter and binary decoder. There are other options, but these are the most straight forward and stick to generic principles that allow for easy expansion and, except for the counter, incredible flexibility.
Let’s start with the hopper/dropper chain.
With a hopper/dropper chain, each hopper faces a dropper, and each dropper faces a hopper to form, well, a single continuous chain. A single item is placed in one of the hoppers in the chain, and a comparator is used to determine if a hopper has the item, which forms the output. Everything is powered from below with redstone torches, keeping the item in one of the hoppers, but when those torches are deactivated, the item flows to the next dropper. When the power is restored, all of the droppers activate, pushing the item along to the next hopper. Longer chains and single sided output can be achieved by filling a pair of hoppers opposite each other with a single item each.
The piston and block ribbon uses four pistons to push a set of blocks, called the ribbon, containing two blocks of redstone. There’s an alternative version that uses glass and a non-transparent block, and there are trade-offs between the two, but we’ll stick with this version. This selector is effectively limited to 15 outputs, which is the smallest of the three, but is also the easiest to implement as an unbroken line of redstone lamps, and may very well be the cheapest. In this configuration, the horizontal (sticky) pistons push the two rows in opposing directions, followed by the vertical (sticky) pistons to fill the gap left by the previous operation.
Lastly, we have the T flip-flop with a binary decoder. Knowing how to build one of these is important because it’s the basis for all decoders and encoders, and you can build cool things like 7-segment displays with them. However; for this application it doesn’t really make sense for a few reasons. First, it’s the slowest of the bunch, having significant input lag, especially when needing more options. Second, it’s the largest of the bunch in terms of area or volume. Third, it’s the hardest to get right. Forth, and probably most importantly, without some complex wiring, it only works with n=2m outputs, whereas the other designs work with an arbitrary number of outputs.