Variables
Variables are sections of memory within the solution which can change their value. Variables have names, current values, and are organised into folders. Imagine a variable representing the current temperature
of a property. The name of the variable might be Home Temperature
and the value might be 21
. The value may change over time.
There are 3 types of variables in the DemoPad solution:
Flags - These are boolean (true / false or
ON
/OFF
) variables. An example might be a Flag calledFront Door Open
which is linked to a magnetic contact sensor. The sensor is either activated or not, representing that the front door is open or not, hence the flag is eitherON
orOFF
.Labels - These are text based variables. An example might be the name of the current room being controlled by the app, in which case the label variable might have the value "LOUNGE" or "KITCHEN" (text values are shown in quotation marks for clarification) - or any other text value.
Numbers - These are numerical variables. An example might be the level of a lighting circuit, which ranges from 0 to 100. That value might be represented with a slider UI page object
Local / Global Variables
It is important to note that, without a Centro-8 or Centro-8M processor, all variables are local to the control app; that is, their value is contained within the single app instance (iOS or Android device) and is not a global system value. Changing the variable value from one iOS / Android device has no effect on any others (in an environment where multiple apps are used).
However, with a Centro-8 / 8M it is possible to make variables global, so that a change to the variable's value is reported system-wide to all devices, and the value is persistant, using the memory of the Centro-8 / 8M.
In order to make a variable global, it needs to be 'ticked':
Note the option to 'tick' a variable will only be there if you have a Centro-8 / 8M in your project.
Not all variables should be global, depending on their use. For example, a flag which represents the state of something physical, such as whether the alarm system is set, or whether the front door is open, should be a global variable. It makes sense that each device should be made aware of any changes, and that the system as a whole should always know the value of the flag. Equally, some variables should not be global - for example a label which represents the room a particular app is controlling. It makes sense that the label should be able to change on one app (to allow the user to control a different room) without affecting other apps, which may be controlling other rooms.