@altenbach wrote:
You are reducing 1000 samples to a single scalar. You probably should operate on all 1000 elements at each iterations of the loop.
Here's what I had in mind...
(Also either simulate aqchisition timing or palce a small wait in the loop. Running as fast as possible is annoying).