For Loop

I come from a matlab background where a for loop can be used to populate an array of data.

sorta like this:

for(int i = 1; i = arrayLength; a++)
{
    variable(i)= measuredValue
}

I am trying to make a "boxcar" filter and just average out a moving average of an analogue channel.

for(int i = 1; i = arrayLength; a++)

The loop will run while the I=arrayLength is true. Should probably be I < arrayLength.

Have you Googled for "moving average arduino"


Rob

groundfungus:

for(int i = 1; i = arrayLength; a++)

The loop will run while the I=arrayLength is true. Should probably be I < arrayLength.

Yes. Perhaps you also want
** **i++** **
rather than a++:

for (int i=0; i<arrayLength; i++)