When posting code, it's a good idea to hit Ctr-T in the IDE first, to format it so that it's readable.
In it's current form, it's a mess.
Edit: There are semicolons missing at the end of these:-
unsigned long timer
unsigned long timer2
timer = millis()
And also from a bunch of other lines.
"IBI" wasn't declared.
Neither was "vibrate", and you didn't make it an output with 'pinMode()' in 'setup()'.
Even if "IBI" was declared, this is no good:-(200 > IBI > 50)You need:-if((IBI > 50) and (IBI < 200))
"BPM" wasn't declared. And is never initialised or modified.
What's this supposed to do?:-if (for (x = 0; x <= 14; x++)
And this:-beatarraysum / 10 = beatarrayavgarray[0];
You use "x" everywhere, but never declare it.
At this point, I gave up. ![]()