Arduino ECG sputtering out totally random values
That amplifier will simply not give you an ECG signal. There's nowhere near enough gain, and the common mode rejection is very bad. You need to get a grip on your data acquisition using some sort of test signal that you can use without your amplifier.  After you get that working, then you can work on a working amplifier.  You'll get nowhere fast trying to work on every aspect of your problem at the same time.

Looking at your code, you seem to be calculating the time between your SAMPLES (which is why you're getting something near constant), which has nothing to do with heart rate.   Somehow, you need to process a VALID ECG signal to yield heartrate.