Hello guys,

I have a code, which stores array of 113 values from the signal. Once the array is full, I want to detach Interrupt and perform calculations. I will create another two arrays of same size and store those values so that I can access them at the very end of calculations. I was pretty much able to store 113 points, but I am not able to do further. I am trying to get rid of arrays, well it looks like my application demands it. Is it possible to handle multiple arrays in one code? Please let me know where I have to make changes. When I try to print other values nothing shows up on screen. Thanks in advance.

```
float Radians[113];
float freq, rpm;
float total = 0;
float radianAvg;
float InstVariation;
float sincomp[113], coscomp[113];
float sincoeffTotal = 0, coscoeffTotal = 0;
float sincoeffavg, coscoeffavg;
float thirdOrder;
volatile boolean finishCount = false;
volatile unsigned long period = 0;
volatile unsigned int i = 0;
long copy_period;
int copy_i;
volatile unsigned long time_last;
int k;
volatile unsigned long interruptCount;
unsigned int copy_interruptCount;
void setup()
{
Serial.begin(115200);
Serial.println("start...");
pinMode(32, INPUT);
attachInterrupt(32, pulsePeriod, RISING);//interrupt on pin3
}
void loop() {
while (1)
{
if (finishCount == true)
{
finishCount = false;//reset flag
noInterrupts();
// disable interrupts, make protected copy of time values
copy_period = period;
copy_interruptCount = interruptCount;
interruptCount = 0;
interrupts();
freq = 1000000.0 / copy_period;
rpm = freq * 0.5309;
Radians[k] = rpm * 0.1048533; // fill the array with 113 values
//Serial.println(Radians[k]);
}
if (sizeof(Radians) == 113) // once the arrray is full make calculations
{
k = 0; //Reset the pointer to zero to overwrite the array
detachInterrupt(32); // detach interrupt to do calculations
for ( int j = 0; j <= 112; j++) { // for loop to add all the 113 values
total += Radians[j];
Serial.println(total);
}
radianAvg = total / 113; // to get the average of 113 values
// Next for loop to calculate variation of each point in array - average of the array, then calculate sin and cos
for ( int k = 0; k <= 112; k++) {
InstVariation = Radians[k] - radianAvg;
sincomp[k] = sin( k * 0.1667) * InstVariation;
coscomp[k] = cos(k * 0.1667) * InstVariation;
sincoeffTotal += sincomp[k];
coscoeffTotal += coscomp[k];
}
sincoeffavg = sincoeffTotal / 113;
coscoeffavg = coscoeffTotal / 113;
thirdOrder = sqrt((sincoeffavg * sincoeffavg) + (coscoeffavg + coscoeffavg)) * 6.24; // Third Order harmonics of the resultant wave.
//debug prints
//Serial.println(thirdOrder);
}
}
}
void pulsePeriod()//simplify isr
{
period = (micros() - time_last);
time_last = micros();
finishCount = true;
interruptCount++;
}
```