If Logic

From Homebrew Patent Unknown Wiki
Jump to navigation Jump to search

If Logic, more commonly known as "If-Then Logic," is a special sub-type of logic. In Homebrew, If Logic is broken down into two mains types. The first type is A-B inequalities. These are handled by the IF Logic Box. And the other type is Combinational Logic, covered in the Binary Logic tutorial. This tutorial will only cover the logic systems that the IF Logic Box can handle.

Firstly, the If Logic Box's name. It may seem deceptively complicated from just its name. However, it does not support coding language, so it is merely A-B inequalities. It is capable of several different methods of outputting and is an extremely versatile logic box. How it works is simple. You first give it two inputs, labelled A and B. Then you add a third input to the inequality sign you'd like to use. So to create the expression A>B, you'd attach a signal to the ">" input. This will output whatever number is input into the ">" input whenever A is greater than B. So for instance, if A were 5, B were 2, and > was 3, then this would make the statement 5>2, which is indeed true, so the If Logic Box would then output a 3.

Multiple statements can be made as well. For instance, if you input the number 1 into both the < and = inputs, then the If Logic Box would output a 1 if either statement were true. Additionally, a common practice with the If Logic Box is to attach a Selector Box immediately after the If box. Then using a 1 for <, 2 for =, and 3 for >. This will create a logic system that can choose between one of three functions depending on the relationship between A and B. Such a system could be useful for automatically changing how a vehicle reacts based on different altitudes. You would do so by using either Relative Altimeter and hooking it to A and keeping B as a constant number. Or by hooking the Y coordinate of a GPS box into A, and again using a constant value for B.