The version 1.9 of uPLibrary is enriched with another managed driver for the management of an anemometer, an instrument used for measuring the wind speed. The driver is generic, considering the common operation for most of all anemometers.
The anemometer I used generates 4 pulses per second to the detection of a wind speed of 10 Km / h; such information is useful to determine the true wind speed by counting pulses in a time interval that can be set. In fact, Anemometer The class provides a constructor whose parameters are the following:
As you can see the default values of the driver are those of the anemometer used for testing.
Inside, the class associates an InterruptPort to pin passed to the constructor and the event handler counts the pulses received from anemometer. To it is added a Timer, which periodically, on the basis of the period provided to the constructor, determines the speed of the wind in relation of the counted pulses. This value is available outside the class through the property WindSpeed. The start and completion of the survey by the timer can be managed through the corresponding methods Start() and Stop ().
1: Anemometer anemometer = new Anemometer(Pins.GPIO_PIN_D0);
2: anemometer.Start();
3:
4: while (true)
5: {
6: Debug.Print("Wind speed = " + anemometer.WindSpeed);
7: Thread.Sleep(1000);
8: }
The library is always available on Nuget !
View this page in another language: