My code for the hardware de-bounce is taken from here:
the only thing changed is the INPUT instead of input pullup.
But as I said, I am trying to get rid of the hardware de-bounce.
I got the new code workingwith these changes:
Rotations = 0; // Set Rotations count to 0 ready for calculations
attachInterrupt(digitalPinToInterrupt(WindSensorPin), isr_rotation, FALLING); //turn interrupt back on
delay (3000); // Wait 3 seconds to average
detachInterrupt(digitalPinToInterrupt(WindSensorPin)); //shut off wind speed measurement interrupt until done communication
WindSpeed = Rotations * 4.0/3.0
but it's not accurate in low speeds because it's counting full revolutions, somebody told me I should:
change the algorithm so that it determined the time for 1 complete revolution (in milliseconds), works out a rolling average over a number of samples and presents the result.
but I don't know how to begin....