Speed using reed switch...

Can anyone tell me how to measure speed from a reed switch and magnet on a bike.

The sensor has a resistor in parallel with the reed switch (i presume it helps with debounce or whatever it is) so I have got as far as using analogRead to read when the value is 1023.

I have tried using millis() to measure the time difference in between the senses but I can't get it to work. Can someone post a code example of how to do it. I can then work out the speed but it's the measuring time in-between senses that I'm having the issue with...

Thanks in advance ;)

Mowcius

Don't connect it to the analogue input use a digital input.

Then look at the pulseIn() function to measure the times between the pulses. This can then be converted into RPM and hence speed.