the regular controllers

Let's get familiar with the basics

  • AND - everything has to be TRUE to return TRUE | at least 1 thing as to be FALSE to return FALSE
  • NAND - at least 1 thing has to be FALSE to return TRUE | everything has to be TRUE to return FALSE
  • OR - at least 1 thing has to be TRUE to return TRUE | everything has to be FALSE to return FALSE
  • NOR - everything has to be FALSE to return TRUE | at least 1 thing has to be TRUE to return FALSE
  • XOR - a single thing has to be TRUE to return TRUE | everything has to be either TRUE, either FALSE to return FALSE
  • XNOR - everything has to be either TRUE, either FALSE to return TRUE | a single thing has to be TRUE to return FALSE

An applied example

Set 1 or many sensors in such a way they emit a TRUE pulse or a FALSE pulse (the use of the "Always sensor", with the 'invert' button to set it to FALSE) . The 6 controllers will either receive a TRUE or a FALSE pulse and will send the results in the Debug proprieties

controller1.png

As you can see, only T1 sends a TRUE pulse to the 6 controllers. Only NAND , OR and XOR controllers return a TRUE output to their respective Actuator. In which case, the actuator toggle the default property from FALSE to TRUE.

in Python or with an Expression

Rather than using those 6 regular controllers, you can build your own expression as it's done for the AND .

controller2.png

The expressions to use for the AND, NAND, OR, NOR, XOR and XNOR

if (F1 = True and F2 = True and T1 = True and F3 = True , True, False)
if (F1 = True and F2 = True and T1 = True and F3 = True , False, True)
 
if (F1 = True or  F2 = True or  T1 = True or  F3 = True , True, False)
if (F1 = True or  F2 = True or  T1 = True or  F3 = True , False, True)
 
if (F1 =  F2 = T1 = F3, False, True)
if (F1 =  F2 = T1 = F3, True, False)

But for the 5 other controllers, let's use python. The code in the python controller is shown below

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License