Question regarding PulseIn function

I know that the PulseIn function reads a pin and times a pulse's duration and returns the duration of the pulse (in ms). Is there a way to access that returned value and store it in an array and take the average of say the last 10 pulse times?

Any insight would be greatly appreciated.

Thank you.


If you only want 10 readings you could use a FOR loop and save each successive reading into the next value of an array.

If you want to take continuous readings and always get a moving average of the most recent 10 values that could also be done.

Make an attempt at code to meet your need and post a copy of it if you need further advice.


Will do.

Thank you, R!