As a new member, I’m attempting to wrap my former Python/C mind around programming logic statements into a handheld application. After reviewing the docs and this board, I am unable to find step-by-step processes for setting up and using variables in CoRE. Thus, I start this learning thread just for conversation about CoRE Variables.
Please, supply case studies and code/screen-capture examples.
- When should you use a local variable vs. a global variable?
- When a variable is global, does that mean it is available to all Pistons?
- When entering the name of a global variable, do I place a @ or $ before it? Is there a difference?
- Where do you print the result of a variable? i.e. which screen shows the output of a variable for testing?
- 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?
Case study, how would we get average temperature and print it? I only have it to a point and I don’t know if it is correct.
Piston Mode: Basic
if (each sensor did not change in the last 1 minute)
First: Save attribute to variable->temperature->Avg-number->@averageTemp
And Then: Load attribute from variable->temperature->@averageTemp
Great, I think I now have an average temperature loaded into the variable @averageTemp, now what? How to I see the resulting value?
How would I:
- text myself the value of this variable?
- use this value in an other interesting ways?
- send this value to another Piston?