General area when it fits no where else

Moderator: Mmiscool

User avatar
By Zim
#74554 I am working with a temp sensor and would like to do a live average of the last 10 samples to give me a more stable reading. Is this possible in basic? I can't find any examples of how to buffer the output.
User avatar
By rudy
#74556 I don't think he was looking to average 10 readings. Instead to average the last 10 readings. And when a new reading is taken it is averaged with the previous 9, with the oldest one being discarded.

I would put the readings into an array. Then average them. When a new reading is read then shift the contents of the array. There are more efficient ways to deal with this but a simple brute force approach will work.

I'm not familiar with Basic so I don't know how to code it.