+2 votes
asked in Prototypes by (270 points)
edited by

I searched for a repo with useful coding tricks for my Toy Con Garage projects on internet. I found this incredible examples by TheDarkNerd so I want to share all with you. Can we together make it bigger? 

Double NOT

This is the Double NOT. It's a pretty basic device, and doesn't look like it does much, mainly due to the fact that what goes into it is exactly what comes out to it.

However, over long distances, it's great for cleaning up wires, such as in a one-to-many or many-to-many set, or even when you just want to have a wire go smoothly around other nodes, rather than bee-lining directly through them.

Another place the Double NOT is useful is when you've got Nodes in the middle of a complex circuit, and you want to create an access point to read them easily. Another neat benefit of the Double NOT is that you can use it as a regular NOT, particularly in situations where you'd want both values (such as when converting an array to a virtual binary array).

Now here we have a simple toggle switch. For the purpose of this demonstration, a Touch Node and a Light Node are used, but these are just example input and output Nodes that could be replaced with the Nodes suited to your task. The top Counter Node is what is actually important for your output, while the purpose of the bottom Node is to immediately reset the counter to 0 once it tries to go to 2 (which is what happens if the switch is already in its "On" state and the input is pressed again).

This is what I refer to as a Paradox Switch. Its function is simple: when an input is pressed, regardless of how long it's pressed, the output itself will only be for a brief moment. This is useful for cases such as timers, particularly those with short intervals, as under normal conditions they will repeatedly fire so long as they have input. You'll notice I have a Double NOT in there, since a Node's output cannot directly feed to its own input.

Here I have two kinds of arrays, both based on Light Nodes and Bullseye Nodes. The left array uses a Move Light Node, and it is one small square wide by 8 small squares tall. It is connected to an analog counter with a value of 0-7. This gives it 8 possible values it could be. As such, for each value, a Bullseye is placed exactly where the light square would end up for the given value.

The Extend Light Node on the right is connected to the same analog counter. However, unlike the Move Light Node, when the counter's value is 0, there is no light present in the Node. Therefore, the light has been made 7 squares tall, in order to keep the same spacing of 1 Bullseye Node per small square.

Of note for the Bullseye Node, is that the value it reads is entirely based upon the smaller circle within the Node. If that circle is entirely filled, that is when the Bullseye will have a value of 100.

By setting the Bullseye Node to Digital, and giving it a range of 0.98-100, you can maximize its sensitivity to allow you to overlap them at their maximum density. Here we have 2 arrays, each with 19 Bullseye Nodes. The smallest increment of size for any node is 1/12th of a small square, with most nodes being able to press down to no more than 2 small squares in either dimension. The Light Node is an exception that can press down to 1 small square in one dimension, and 2 small squares in the other. The Light Nodes in these arrays are 2.5 squares tall, as they take up one whole square for their 0 value, and then 1/12 of a square for each additional increment. With 18 additional increments, this is an addition 1.5 squares. The reason there is 19 values in this array, as opposed to 18, is due to a property of these nodes, where if they have an even number of total values, the Light Node will be offset by 1/24 on either side, which makes it almost impossible to line up the Bullseye Nodes with.

Here we have an array that involves no Light Nodes, useful if you're trying to hide your array in a spot that would otherwise be visible when in Play mode. It is designed to only increment, and then roll over once it increments past its maximum value. The Counter Node next to the Touch Node is the "master" Node. Its range is set to the minimum and maximum values desired for the array. The array is designed so that all Counter Nodes in the array increment and reset at the same time, so that their values are always equal. Each of the Nodes in the array, other than the "master" Node, has a single value range, so that only one actual Node has a state of "On" at any given time. In the picture above, the Node with the range of 4-4 is currently lit.

I learned the hard way that you can only have a maximum of 5 Comment Nodes on any one project.

(I would also like to point out I made a minor mistake. The Node labeled "3-3" should actually be labeled "2-2").

Here we have an Array designed so that it cannot exceed its maximum value. This is accomplished by filtering the Input Node through an AND Node tied to the master Node. The master Node's maximum value is one less than the maximum value of the array, so that once the array reaches its maximum value, the master Node is no longer outputting, shutting off the AND Node.

(Once again, I used the same labels as the image above, so 3-3 should, in fact, be 2-2.)

Do you have new ones? Another approach to do same coding? Share yours with the community laugh

1 Answer

0 votes
answered by (180 points)
This is brilliant. Wish I’d found it before coding!!


Welcome to LABO builders, where you can ask questions and receive answers from other members of the community.