Page 1 of 1
Circuit delaying
Posted: Mon Jan 22, 2018 2:39 am
by Hex-Advure
is it possible to have a signal come into the circuit network for a fraction of a second, and have this cause a differant signal to come out for a minute?
Re: Circuit delaying
Posted: Mon Jan 22, 2018 4:13 am
by DaveMcW
Arithmetic combinator: Each - 1 → Each, connected to itself.
Send it a value of 3600 for 1 tick (or 1800 for 2 ticks, or 1200 for 3 ticks, depending on how long it takes you to turn off the signal). It will count from 3600 to 0 for one minute then stop.
Re: Circuit delaying
Posted: Mon Jan 22, 2018 4:18 am
by Hex-Advure
DaveMcW wrote:Arithmetic combinator: Each - 1 → Each, connected to itself.
Send it a value of 3600 for 1 tick (or 1800 for 2 ticks, or 1200 for 3 ticks, depending on how long it takes you to turn off the signal). It will count from 3600 to 0 for one minute then stop.
is there a way i can find out how many ticks a signal lasts for?
Re: Circuit delaying
Posted: Mon Jan 22, 2018 4:29 am
by DaveMcW
Tick 0: Read input signal
Tick 0: Read countdown combinator output
Tick 1: If input signal > 0, A = 1
Tick 1: If countdown combinator < 1, B = 1800
Tick 2: A * B → C
Tick 2: Pass C to countdown combinator and the combinators in tick 0.
In this case, it takes 2 ticks to turn off the signal.
Re: Circuit delaying
Posted: Mon Jan 22, 2018 5:25 am
by Hex-Advure
DaveMcW wrote:Tick 0: Read input signal
Tick 0: Read countdown combinator output
Tick 1: If input signal > 0, A = 1
Tick 1: If countdown combinator < 1, B = 1800
Tick 2: A * B → C
Tick 2: Pass C to countdown combinator and the combinators in tick 0.
In this case, it takes 2 ticks to turn off the signal.
I don't reallly understand what you mean. i'm knew to circuit networks, sorry.
Re: Circuit delaying
Posted: Mon Jan 22, 2018 8:42 am
by golfmiketango
Pretty sure DaveMcW's thing above is a fairly advanced solution to a different question than the one you're actually intending to ask.
If you want to count the amount of time a circuit network didn't change, you can break the question into two questions: "how can I count ticks between pulses", then the only question left is "how can I get a pulse when the circuit network changes?" The second question is pretty easy, you just sum EACH*EACH(-1) arithmetic combinator hooked up to the original signal with the original signal (note the 1-tick discrepancy this creates -- so you are effectively getting the signal right now minus the signal one tick ago), and check if the result is nonzero using a decider. The first... is maybe best answered in a context-dependent manner but probably should involve a decider with its input wired up to its output. This can act a as a sort of "maybe accumulator, maybe forgetter" device.
If this is your first combinator build, you picked a pretty tricky place to start. You might try to find a way to avoid this until you're past the learning curve in the middle of your combinator-education and revisit this topic later.