CoRE - Variables 101

I don’t have all the answers but…

Questions:

  1. When should you use a local variable vs. a global variable?
    I try to just use local when I don’t want to share the value of the variable with other pistons.

  2. When a variable is global, does that mean it is available to all Pistons?
    Yes

  3. When entering the name of a global variable, do I place a @ or $ before it? Is there a difference?
    When creating it just type the name you want to use “variableName”. When using the variable in text you need to use “{variableName}”.

  4. Where do you print the result of a variable? i.e. which screen shows the output of a variable for testing?
    You can do a sendNotification

  5. Must you set the name and initialize a global variable under Global Variables on the main page? If not, what is the Global Variables on the main page meant for?

I can’t remember.

I don’t think you want to use “Save attribute” and “Load attribute”. I think you want to use “Set Variable”.

Here is an example of me using a variable… “diningRoomLightsOnByThisPiston”.

I might not be talking about the same thing you want. However, here is a post where someone is discussing average temp and core.

2 Likes