Advanced Mechanics: Loops
We're back with another lesson, and this time we're getting into something a little more advance. Pay close attention and find out everything you need to know about Loops! A Loop is a circuit that, once activated, will keep going until it is stopped. There are a few ways to build a loop, check out one of the ways down below.
For this demonstration, we'll need two Timers, one Button, one Splitter, one Hub and one Dice. For today's loop, we're going to set up the items to have the Dice roll continuously when we push a Button.
First, let's set up our furniture like this :
The blue Hub is used to Start the main Timer. Two things will trigger the start of the Timer:
1. When the Button is pressed (to start the loop)
2. When the second Timer completes (to keep the loop going)
Let's connect them!
Connect the Power Output A of the Button to the Hub
Connect the Complete Output of the Timer on the left to the Hub
Connect the Power Output A of the Hub of the Timer on the right Start. Your circuit should look like this :
You can test out your circuit so far to make sure everything is good! If you close the Wire Menu and click the Button, the Timer should start. If you click the Timer on the left and let it complete, it should also start the other Timer. Now, where do we want to go from here? Well, when the main Timer completes its circuit, we want the Dice to roll AND we want the second Time to start. Remember, the second Timer will start the loop!
This is where the Splitter comes in!
Connect the Complete Output of the main Timer to the Splitter
Connect the Power Output A to the Dice
Connect the Power Output B into the Start input of the second Timer
When the main Timer completes, the Dice will roll and the second Timer will start. Your circuit should look like this :
All that's left to do is adjust the Timers! Set both Timers to 2 seconds :
There you have it, a functioning loop! But what if you want it to stop? One way would be to remove one Timer from your Unitz to break the Loop... But we can do it in a more elegant way. Let's add a Button and a Splitter to stop both Timers with the same tap of the Button :
Connect the Power Output A of the Button to the Splitter
Connect the Power Output A of the Splitter to the first Timer's Stop input
Connect the Power Output B of the Splitter to the second Timer's Stop input.
There you have it, your loop has stopped!
Stay tuned for the next MasterClass. Let us know what kind of loop you're creating for your Unitz!