Page 1 of 1

Maximum value of a variable?

Posted: Sat Mar 10, 2018 2:20 am
by WestleyTwain
Sometimes I see that even though the wiimote is standing still, its acceleration is sometimes more than 9.8, which should not be possible. I want to watch the wiimote[0].acceleration.z output over time and see what the biggest number so far has been. Occasionally it'll even be a 2 digit number, but only for a frame or two.

How can I watch the maximum output of a variable?

Re: Maximum value of a variable?

Posted: Sat Mar 10, 2018 3:03 pm
by Jabberwock
Declare a gobal variable, as described here:
https://github.com/AndersMalmgren/FreeP ... /Scripting

If the reported input is higher than the variable, put it in the variable.

Watch the variable.

Re: Maximum value of a variable?

Posted: Sat Mar 10, 2018 4:57 pm
by WestleyTwain
Jabberwock wrote:Declare a gobal variable, as described here:
https://github.com/AndersMalmgren/FreeP ... /Scripting

If the reported input is higher than the variable, put it in the variable.

Watch the variable.
works like a charm. Thanks!

Re: Maximum value of a variable?

Posted: Sun Mar 11, 2018 3:46 am
by Jabberwock
Glad I could help!