Can I run 3 copies of RunningAverage.h at the same time? I am attempting to find relative accelerometer motion in three axis simultaneously to produce a z score. this is a test using example furnished with the library. Can I interleave or multiplex. Sample size will probably need tobe altered on thefly as code progresses. Thanks a lot.
//
// FILE: runningAverageTest.pde
// AUTHOR: Rob Tillaart
// VERSION: 0.1.01
// DATE: 2012-12-30
//
// PUPROSE: show working of runningAverage
//
#include "RunningAverage.h"
RunningAverage myRA(10);
int samples = 0;
void setup(void)
{
Serial.begin(115200);
Serial.println("Demo RunningAverage lib");
Serial.print("Version: ");
Serial.println(RUNNINGAVERAGE_LIB_VERSION);
myRA.clear(); // explicitly start clean
}
void loop(void)
{ int x=analogRead(A0);
int u=myRA.getAverage();
int s=myRA.GetStandardDeviation();
int z=(x-u)/s;
//long rn = random(0, 1000);
myRA.addValue(x);
// samples++;
// Serial.print(samples);
// Serial.print("\t Running Average: ");
Serial.println(z);
/* if (samples == 300)
{
samples = 0;
myRA.clear();
Serial.println();
}*/
delay(10);
}