Library for interfacing to Sparkfun Weather Meters.
Dependents: WeatherStation Deneme testgeneral ... more
CWeatherMeters Class Reference
A class to interface with the Sparkfun Weather Meters. More...
#include <WeatherMeters.h>
Data Structures | |
struct | SMeasurements |
A structure in which the current measurements registered by the weather meters are returned from the GetMeasurements() method. More... | |
Public Member Functions | |
CWeatherMeters (PinName AnemometerPin, PinName RainGaugePin, PinName WindVanePin, float WindVaneSeriesResistance=10000.0f) | |
Create a CWeatherMeters object, binds it to the specified input pins, and initializes the required interrupt handlers. | |
void | GetMeasurements (SMeasurements *pMeasurements) |
Gets current weather meter measurements. | |
void | Reset () |
Resets all historical measurements: rainfall and maximum wind speed. | |
void | ResetRainfall () |
Resets the cumulative rainfall measurement. | |
void | ResetMaximumWindSpeed () |
Resets the maximum wind speed measurement. |
Detailed Description
A class to interface with the Sparkfun Weather Meters.
http://www.sparkfun.com/products/8942
This set of weather meters from Sparkfun includes anemometer (wind speed), wind vane, and rain gauge. All of the sensors use reed switches so that the electronics can detect motion/location in the sensor hardware via magnets placed in the sensors without actually exposing the electonic switches themselves to the elements. A reed switch closes as the anemometer spins and the rain gauge empties. The wind vane includes 8 reed switches, each with a different valued resistor attached so that the voltage will vary depending on where the magnet in the vane is located. Example:
#include <mbed.h> #include "WeatherMeters.h" int main() { CWeatherMeters WeatherMeters(p9, p10, p15); for (;;) { CWeatherMeters::SMeasurements Measurements; WeatherMeters.GetMeasurements(&Measurements); printf("Direction: %s\n", Measurements.WindDirectionString); printf("Depth: %f\n",Measurements.Rainfall); printf("Current speed: %f\n", Measurements.WindSpeed); printf("Maximum speed: %f\n", Measurements.MaximumWindSpeed); wait(1.0f); } }
Definition at line 65 of file WeatherMeters.h.
Constructor & Destructor Documentation
CWeatherMeters | ( | PinName | AnemometerPin, |
PinName | RainGaugePin, | ||
PinName | WindVanePin, | ||
float | WindVaneSeriesResistance = 10000.0f |
||
) |
Create a CWeatherMeters object, binds it to the specified input pins, and initializes the required interrupt handlers.
- Parameters:
-
AnemometerPin The mbed pin which is connected to the anemometer sensor. Must be a pin on which the mbed supports InterruptIn. RainGauagePin The mbed pin which is connected to the rain gauge sensor. Must be a pin on which the mbed supports InterruptIn. WindVanePin The mbed pin which is connected to the wind vane sensor. Must be a pin on which the mbed supports AnalogIn. WindVaneSeriesResistance The value of the resistance which is in series with the wind vane sensor and along with the varying resistance of the wind vane sensor itself, acts as a voltage divider.
Member Function Documentation
void GetMeasurements | ( | SMeasurements * | pMeasurements ) |
Gets current weather meter measurements.
NOTE: Should call this method on a regular basis (every 15 minutes or less) to keep internal timers from overflowing.
- Parameters:
-
pMeasurements points to the measurement structure to be filled in with the current measurement from the sensors. The historical values in this structure such as rainfall and maximum wind speed can be reset by calls to ResetRainfall(), ResetMaximumWindSpeed(), and Reset().
void Reset | ( | ) |
Resets all historical measurements: rainfall and maximum wind speed.
void ResetMaximumWindSpeed | ( | ) |
Resets the maximum wind speed measurement.
void ResetRainfall | ( | ) |
Resets the cumulative rainfall measurement.
Generated on Fri Jul 15 2022 00:08:29 by 1.7.2