Malacodor's logic corner

    Joined
    Mar 2, 2014
    Messages
    1,293
    Reaction score
    230
    • Thinking Positive
    • Community Content - Bronze 1
    • Legacy Citizen 3
    This is mainly for players who already know how the individual logic and rail blocks work, but need help with combining them in a useful way or just look for some inspiration.

    1. Activating stuff in a sequence - and deactivate it in reverse order
    2. Wiring for a hidden turret elevator and the like

    1. Activating stuff in a sequence - and deactivate it in reverse order

    Logic Corner 1.jpg

    The block where the user input happens is depicted in blue, the rest in orange.

    The first part is easy, just link delays in a chain to an activator. Then connect whatever you want to activate to the delays. The tricky part is the deactivation in reverse order.

    To keep the first delay from switching off when deactivating the activator we put a flip-flop between them. Now we hook the activator up to an AND gate and create a two-way connection between this gate and the last delay (C on gate -> V on delay, C on delay -> V on gate). This way the AND gate activates together with the last delay. When the activator is toggled off the AND gate deactivates as well and sends an off signal to the delay. Note that delays don't act as OR gates and deactivate when receiving an off signal, no matter whether there's still an (older) on signal from another block.

    After adding two-way connections between the delays we can already activate and then deactivate in reverse. But we still have to reset the flip-flop. To do this we link the first delay to a NOT gate, the NOT gate to a button and the button to our flip-flop.

    2. Wiring for a hidden turret elevator and the like

    You might have seen one of these fancy turrets which are hidden behind a door and can move to the outside on rails. The logic behind these makes the elevator start after the door has opened and also works in reverse. In theory the circuit from above could do the trick, but the number of delays had to be adapted to fit the time the door and the elevator take to move. So it's better to do it in a smarter way. This circuit can of course be used for many other things that require for the second step to wait until the first one has finished. Also, it can be expanded to any number of steps.

    Logic Corner 2.jpg

    We could simply use a single activator, but we want some more control. Changing the state of said activator while the circuit is already running could cause problems. By using buttons instead we can easily avoid this.
    Also, having two buttons, one for 'out' and one for 'in', means that there's no danger of our sample turret being retracted instead of brought out because it was already out without us knowing that.
    1. Let's start with learning how to create only a single 'on' signal, no matter how often the button is pressed. While the flip-flop is off the NOT gate is on and pressing the button will activate the AND gate. As soon as the flip-flop is on the NOT gate goes off preventing any further input through the AND gate.

    2. Box number two shows the opposite, the AND gate only reacts on the button when the flip-flop is on, switching it off. We can use this to reset the flip-flop at the end of a run.

    3. Now we combine both into a fully functional curcuit. Pressing the upper button will toggle the green light on and the lower one the red light. The button at the end will then reset whichever flip-flop is on and the respective light turns off again. Note that the NOT gates are both linked to two AND gates each, this way starting a sequence blocks further input from both buttons.

      This circuit does nothing else than two buttons hooked up to the lights directly, but the lights are just placeholders.

    4. Here we have a sample rail consisting of five blocks, but it can have any length. Since we want to have some feedback about what's going on we put activators next to the first and last rail and buttons next to all rail blocks in between. The activators are connected to red and green lights. Which color is used for open or closed, up or down or whatever function the rails have depends on your personal preference.

      Link the buttons to an OR gate and the OR gate to a yellow light, which will indicate that there's something moving on the rail. The light will either blink or stay on during movement depending on the rail speed. If it blinks too often or is on for too long, this indicates that the object docked to the rail is stuck.

      All lights are optional and will be ignored below.

    5. Here we see one of our flip-flops connected to rail blocks and to an AND gate. The AND gate also receives input from one of the activators at the end of the rail, make sure it's the correct end. As soon as the docked object reaches the end of the rail the activator will turn the AND gate on and initiate phase 2.

    6. Now we put everything together. The colored frames indicate which blocks are connected to which rails. After the last rail sends its signal to the reset button via AND gate the circuit will accept new inputs again.

      If you have more steps in your setup just add more AND gates with rails before the last AND gate.

    Edit: update and formatting

    Feedback and questions appreciated.
     
    Last edited:
    Joined
    Mar 23, 2015
    Messages
    293
    Reaction score
    52
    It is so nice to see someone make a "how to" with a clean illustration and a couple paragraphs of text, as opposed to rambling on and on for a half-hour video that imparts 2 minutes of info. Thanks!
     
    • Like
    Reactions: zigyzigy
    Joined
    Mar 2, 2014
    Messages
    1,293
    Reaction score
    230
    • Thinking Positive
    • Community Content - Bronze 1
    • Legacy Citizen 3
    Updated the OP with "Wiring for a hidden turret elevator and the like"