Turns out all my anemometer code so far is wrong, equations is not my strong suit and I seemed to be always trying to overwork the equation.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// work out wind speeds function float CalcWindSpeed(int clicks, int seconds) { // Caluculate Wind Speed // Work out number of clicks per second averaged over time period float windSpeed = (float)clicks / seconds; // since we know 1 click over 1 second equals 1.492 mph // apply the multiplier windSpeed *= 1.492; return windSpeed; } |
The above is mostly the code I am using now. I have tweaked it since to allow float seconds so I can use the same procedure to work out the gusting speed.
The above code is borrowed from Sparkfuns Weather Station Tutorial.