Simple Logic Request Thread

    Joined
    Feb 22, 2015
    Messages
    869
    Reaction score
    179
    • Purchased!
    • Legacy Citizen
    What I need
    Press Button1 a Flip-Flop is turned ON. If the FF is already ON, it stays ON.
    Press Button2 and the same FF is turned OFF. If the FF is OFF, it stays OFF.

    This is to activate indicator lights in some already existing logic.

    I feel I should be able to figure this out myself, but I just can't seem to wrap my head around it tonight.
     
    Joined
    Jul 21, 2013
    Messages
    2,932
    Reaction score
    460
    • Hardware Store
    What I need
    Press Button1 a Flip-Flop is turned ON. If the FF is already ON, it stays ON.
    Press Button2 and the same FF is turned OFF. If the FF is OFF, it stays OFF.

    This is to activate indicator lights in some already existing logic.

    I feel I should be able to figure this out myself, but I just can't seem to wrap my head around it tonight.
    You don't need a flipflop, these 2 lines should describe what you need:
    Button1->OR1->AND1->LIGHT1
    Button2->NOT1->AND1->OR1
     

    Master_Artificer

    Press F to pay respects
    Joined
    Feb 17, 2015
    Messages
    1,588
    Reaction score
    612
    • Top Forum Contributor
    • Legacy Citizen 2
    • Thinking Positive
    How do I blink lights?

    Specifically, I want to make a clock that I can blink maybe one set of lights where they turn on for half a second, then maybe another set of lights blink, then another, with each light staying off for maybe 5-10 seconds inbetween blinks. Or maybe one set on a 4 second loop and another on a 10 second, and occasionally they will sync up... :)

    Thanks!
     

    Tunk

    Who's idea was this?
    Joined
    Sep 8, 2013
    Messages
    363
    Reaction score
    153
    • Purchased!
    • Community Content - Bronze 1
    • Legacy Citizen 4
    Button clock sounds like what you'll want.
    Button -> as many delays as you want -> back to button.
    Slap the button to start it.

    Button clocks send a pulse down delay chains, so great for things like blinkers.
     

    Master_Artificer

    Press F to pay respects
    Joined
    Feb 17, 2015
    Messages
    1,588
    Reaction score
    612
    • Top Forum Contributor
    • Legacy Citizen 2
    • Thinking Positive
    Button clock sounds like what you'll want.
    Button -> as many delays as you want -> back to button.
    Slap the button to start it.

    Button clocks send a pulse down delay chains, so great for things like blinkers.
    Wow, buttons. I was using ands with nots and ors with delays, and it wouldnt work half the time...
    BUTTONS! GENIUS!!! thanks so much man, that makes it seem really simple!
     
    Joined
    Jul 13, 2015
    Messages
    21
    Reaction score
    1
    OK so, wondering if anyone still sees this thread. can anyone help me build a counter that counts to 12 with a button and then counts backwards with a different button? but if i hit the count button 4 times, i could then hit the count down button 4 times and it ends up at 0? i have a counter but it only goes up then resets, i need this for my dock and auto doors. i hit the rail button to start the rail the doors open and the ships move, once the ship leave the doors close. thats the easy part. the hard part is, i have 12 ships docked in the same hanger. i can only launch 1 wait till it leaves then launch 1 more, if i do 2 the door closes on the second ship, so the counter is needed so if i launch 5 ships ( hitting the 5 different launch buttons, the counter goes up, and as the ships leave they hit a rail button right before the door and as they leave the station, when the counter reaches 0 the door will close after like 10 seconds)
     
    Joined
    Feb 16, 2016
    Messages
    67
    Reaction score
    42
    Here is a compact solution:
    12counter.png

    Flip-flops FF1-FF4 are chained: FF1's output goes into FF2 and so on up to FF4. Button B1 feeds FF1. This is the down counter. Button B2 feeds ALL the flip-flops. This is the up counter. Since you need 12-counter, this means whenever the FF chain goes over 11, 12 must be subtracted from it. Numbers over 11 are: 1100 (12), 1101 (13), 1110 (14) and 1111 (15). In other words: when both FF3 and FF4 are on, 12 must be subtracted. This is what the two delays and the AND gate do. The and becomes 1 half a second after the chain contains a number >11. When it's ON, it will send a pulse to FF3 & FF4 thus subtracting 12. This way 12 will become 0, 13 -- 1, 14 -- 2 and 15 -- 3. The chain has 12 stable states.

    Hope this helps.
     
    Joined
    Feb 16, 2016
    Messages
    67
    Reaction score
    42
    And another solution. This one is instant but is irregular in some way:
    12counter-2.png

    Here the chain FF1-FF4 and the buttons B1 & B2 are the same as above. Each flip-flop has a NOT output too. The A1 and gate is fed by B1, FF3 and the inverse of the other flip-flops. This way it becomes on when the chain contains 4. When it's on it feeds FF3 thus subtracting 4 from the chain. Similarly, A2 and gate is fed by button B2 and all the nots. It becomes on when all the FFs are off (zero). When it's on it feeds both the FF3 and FF4 chains thus subtracting 12 which is actually adding 4.

    So the idea is the chain to count from 4 to 15 in both directions. However there is a tricky part: due to instant pulses states 4 (0100) and 0 (0000) are both possible and the chain can count either from 4 to 15 or from 5 to 16(=0). Thus state 0000 and 0100 represent the same 'zero' state and that's why they have to be OR-ed. All the other states match for both directions.
     
    Joined
    Jul 13, 2015
    Messages
    21
    Reaction score
    1
    Here is a compact solution:
    View attachment 24308

    Flip-flops FF1-FF4 are chained: FF1's output goes into FF2 and so on up to FF4. Button B1 feeds FF1. This is the down counter. Button B2 feeds ALL the flip-flops. This is the up counter. Since you need 12-counter, this means whenever the FF chain goes over 11, 12 must be subtracted from it. Numbers over 11 are: 1100 (12), 1101 (13), 1110 (14) and 1111 (15). In other words: when both FF3 and FF4 are on, 12 must be subtracted. This is what the two delays and the AND gate do. The and becomes 1 half a second after the chain contains a number >11. When it's ON, it will send a pulse to FF3 & FF4 thus subtracting 12. This way 12 will become 0, 13 -- 1, 14 -- 2 and 15 -- 3. The chain has 12 stable states.

    Hope this helps.
    this might just work, i will be trying this tonight when I get home from work now :) thank you
     
    Joined
    Jul 13, 2015
    Messages
    21
    Reaction score
    1
    Thank you for the help!!! It works like a charm, i had to make a small change it now stops at 12 and the count up button gets disabled so if for some reason it gets tripped the door does not close, also the same for count down button, it geys disabled when the counter is at 0. this change took me 15 mins with your original. Without that i had spent 4 hours and still did not get it. THANK you again very much
     
    Joined
    Dec 24, 2014
    Messages
    45
    Reaction score
    14
    • Legacy Citizen
    I have put a button next to rail rotator and slaved it to that button. When I press that button rotator spins endlessly and that is what I want. But when I restart game(reload the ship) it is not spinning anymore.

    What is the most compact 100% reliable way to generate single pulse when ship loads? Button slaved to On state activation module maybe? (too lazy to restart game 10 times to find out)

    Also are there any other bugs/intricacies with rail rotators happening when loading a ship that I need to know about before making complicated contraptions. I remember over last summer there was a bug which made rotators sometimes do 1 cycle when loaded and that obviously fucked up my whole system.

    Also with normal rails, when loading, if entity loads in middle of rail track it will just keep moving along that track, right? Just as it had to be moving before in order to be saved in that state?
     
    Last edited:

    Jaaskinal

    ¯\_(ツ)_/¯
    Joined
    Jan 19, 2014
    Messages
    1,377
    Reaction score
    646
    • Legacy Citizen 4
    • Wired for Logic Gold
    • Thinking Positive
    I have put a button next to rail rotator and slaved it to that button. When I press that button rotator spins endlessly and that is what I want. But when I restart game(reload the ship) it is not spinning anymore.

    What is the most compact 100% reliable way to generate single pulse when ship loads? Button slaved to On state activation module maybe? (too lazy to restart game 10 times to find out)

    Also are there any other bugs/intricacies with rail rotators happening when loading a ship that I need to know about before making complicated contraptions. I remember over last summer there was a bug which made rotators sometimes do 1 cycle when loaded and that obviously fucked up my whole system.

    Also with normal rails, when loading, if entity loads in middle of rail track it will just keep moving along that track, right? Just as it had to be moving before in order to be saved in that state?
    This should do. It's two extra logic blocks on the button.
     

    Attachments

    • Like
    Reactions: Fireshock

    Az14el

    Definitely not a skywanderers dev
    Joined
    Apr 25, 2015
    Messages
    848
    Reaction score
    325
    • Legacy Citizen 2
    • Purchased!
    • Community Content - Bronze 1
    pls make with logic some more ram for me to play SM with
    and without bugs or lag ty, and make sure it has proper USD
     
    Joined
    Apr 24, 2013
    Messages
    436
    Reaction score
    73
    • Legacy Citizen 3
    pls make with logic some more ram for me to play SM with
    and without bugs or lag ty, and make sure it has proper USD
    Um, what are you asking for? A block of logic ram that can dock to USD style?