if (for (x = 0; x <= 14; x++){beatarrayavg[x] + 2 <= beatarrayavg[x + 5]{
digitalWrite (vibrate, HIGH);
}
That is supposed to basically say if any beatarrayavg is more than 2 lower than a beatarrayavg 5 values in the future, it will trigger an alarm. Unfortunately, it doesn't work. How can I reformat this?
I interpret the above as meaning:-
for(int x = 0; x <= 14; x++)
{
if(beatarrayavg[x + 5] - beatarrayavg[x] >= 2)
digitalWrite (vibrate, HIGH);
}
How close is that to what you want? (Nothing in your code ever turns that alarm off again, by the way. I hope that's what you were aiming for.)
And in future, please stick to one statement per line. If you do that, many of your errors will be immediately obvious. (And we won't struggle as much trying to understand your code.)
You might want to rethink this next, if you haven't already done so:-
timer = millis()
if (timer > 1500){