Hi I am bringing in a BPM value from an external heart rate sensor at a rate of one reading per second.
I would like to have a continuous average reading of the previous 60 readings (IE an average that constantly updates and can be called on at any stage as opposed to once every minute).
What is the best way to constantly update an average like this…and how do I get Unreal to wait until the new incoming sensor reading before adding the newest value to the calculation ? Is the best way to create an array with 60 values whereby once the last array is stored or written over it begins writing over the first array in the list. And every time a new number is stored in the array and average is calculated ?
(Sometimes the sensor readings don’t differ IE a user could have a heart rate of 60 bpm for several seconds, so putting in an if statement to detect if the latest sensor value differs from the previous value won’t be an option for detecting a new incoming reading.