Updating and displaying a global variable ?
Posted: 04 May 2013 23:40
Hello,
I am trying to create a global variable, update and display it. My global variable is meant to store the lowest value encountered on the accelerometer's z axis, just to see what is the lowest value I can get when hitting the iPad's surface.
So, I have created my global variable using a project script :
Then, I have a Monitor with this script attached:
The value for the Monitor is set to "check()".
However the displayed value is 0 and never changes.
What's wrong ?
I am trying to create a global variable, update and display it. My global variable is meant to store the lowest value encountered on the accelerometer's z axis, just to see what is the lowest value I can get when hitting the iPad's surface.
So, I have created my global variable using a project script :
Code: Select all
// this script is named "mini"
// Execution: on load
decl thresh;
thresh = accelerometer[2];
Code: Select all
// this script is named "check"
// Execution: on expression - accelerometer - any
if (accelerometer[2] < mini.thresh) {
setattribute(mini.thresh, 'value', accelerometer[2]);
}
return mini.thresh;
However the displayed value is 0 and never changes.
What's wrong ?