code to record wind speed

Thank you for correcting your post.

How do you want to use the anemometer? The simplest way is to time the interval between pulses. But the disadvantage is that you will be measuring every gust and lull in the wind. Maybe that is what you want, or maybe you want to calculate the average wind speed over a longer period so that gusts do not affect the reading?