Blocks
This is a bit of a dry theoretical explanation, but to get the most out of BrainBuilder, it is helpful to get a general idea of the concepts used. The examples are extremely basic, and not meant to illustrate the entire set of possibilities (they’re endless!). We hope you’ll browse through this page.
A block is an abstract entity. A block performs a function.
There are several types of blocks:
- Hardware blocks that read from and write to hardware.
- Logic blocks process inputs, rules, and write to outputs.
- Specialized blocks, which have complex functionalities built-in (for handling LCD screens or keyboards)
All blocks can have inputs (also called sources) and outputs.
In- and outputs communicate via variables. Outputs set variables, inputs read variables.
A block can own variables. When a block is added, a variable, usually with the same name as the block, is automatically created.
For instance, a blinker block named ‘myblink1’, automatically creates an output variable ‘myblink1’ that goes high and low on the frequency specified in the ‘myblink1’ block, and can be used for making a LED blink.
To make 'led1' blink; specify 'myblink1' as the source in 'led1'
A switch named 'sw1' automatically create a variable named 'sw1' that represents
the state of the hardware switch. You can use variable 'sw1' to control the state
of another variable directly, or use it in a rule.
A block can own input variables.
A LED block called 'led1' automatically creates a variable named 'led1'.
By changing the value of variable 'led1', the hardware LED can be turned on or off.
A rule block
to connect a switch 'sw1' to a led 'led1', you write a rule like: "led1 = sw1; "
This links the output of 'sw1' to the input 'led1' via the rule
Derived variables (or expressions) are a special kind of variable to make things easy. A block can follow an expression. In that case it does not have its own input variable(s).
The beauty of our design is that the system only performs work when things change. For example when a variable changes or timer events occur.
The are multiple subsystems, for displays, for keyboard, for settings and for telemetry.