I am making a speedometer for my bike with an arduino and I have got it to display speed now I want to display average speed. But I'm struggling to think of how to do it. The speed is checked 1000 times a second.
If anyone could help that would be great. Thanks!
If you want the average speed over the last $5$ minutes you can just add up the last $300,000$ speed values and divide by $300,000$. Once you get the sum started you can just update it by adding the new value and subtracting the old one. Storing the speed data in a circular buffer will make this easy. You might want to add the speed data in blocks of $1000$ to get a speed for the second first.