Page 1 of 1

How do I play an alarm for x amount of seconds?

Posted: Tue Nov 17, 2020 12:27 am
by Deliberate Grief
Instead of 1 beep alarm from my programmable speaker, I want to play it for 10 seconds. How can I do that?

Image

I connected this with a green wire to my passive provider chest. So, whenever a Atomic Bomb is made, the alarm goes off, but it only happens once. I want it to beep for a few seconds and then stop.

Re: How do I play an alarm for x amount of seconds?

Posted: Tue Nov 17, 2020 1:11 am
by MassiveDynamic
I tried to explain the build process, but I couldn't build it in my head, so I built you a blueprint.

300 is 5 seconds, 60 ticks/second. You can set X<300 to however long you want the alarm to play.




Here is one for multiple assemblers feeding the belt




Here it is with provider chest and 10 second timer...

Re: How do I play an alarm for x amount of seconds?

Posted: Tue Nov 17, 2020 6:26 am
by Zanthra
You can use two decider combinators. Both set to activate if "each" (under the signals category) is less than the minimum number of ticks you want the alarm to go off for (300 for 5 seconds). One of the combinators is set to ouptut "each" with a value of the input count, and the other set to output "each" with a value of 1. Now if you wire all the inputs and outputs of those combinators together you will have a counter that if primed, will count up by 1 each tick until it reaches the limit (together they output "value + 1"). When that happens, both combinators will not output anything. Because of how the "each" signal works, a non-existant value won't be compared with the limit and so nothing will be compared or output even though the value is arguably less than the limit. Now to start the counter, use the other color of wire, and connect your input signal chest to the input of the decider set to output a value of 1. If it sees an Atomic Bomb on the input, it will inject the atomic bomb signal into the counter, and will start counting to the upper limit.

You can use the signal network that wires the combinator inputs and outputs together to drive your alarm with a condition of Atomic Bomb > 0 as the counter will count from 1 to the limit.

Here is a blueprint demonstrating it.


Re: How do I play an alarm for x amount of seconds?

Posted: Wed Nov 18, 2020 11:04 pm
by Deliberate Grief
MassiveDynamic wrote:
Tue Nov 17, 2020 1:11 am
Zanthra wrote:
Tue Nov 17, 2020 6:26 am
Thanks to both of you, it's working perfectly.