05-18-2022 03:08 PM - edited 05-18-2022 03:16 PM
Hello,
I have a realtime acquisition that happens every 1/10 of a second (the loop fires about every 100ms)... I would like to continually build an array of 5 collected values and then send it off to another part of the program (produced consumed), and then zero the array and do it again, continually.
Any suggestions on how to do this? My example just seems to build an array of 5 of the current reading, not the last 5 readings... wondering if there is a way to only execute the loop on "consumed deque" (not sure if I'm saying that right).
thank you
Solved! Go to Solution.
05-18-2022 04:38 PM - edited 05-18-2022 04:39 PM
I solved it I think... changed it to a while loop instead of the FOR loop which was executing 5 times every while loop iteration.
05-18-2022 06:40 PM
It is generally a bad idea to constantly resize arrays (does not matter too much with such small arrays, but it's a bad habit!)
All you need is an array initialize with 5 element where you replace the oldest and send it off whenver five have been replaced.
Here's a quick draft. Modify as needed.
05-20-2022 11:09 AM
Thank you!