Weather Meters (Sparkfun) http://mbed.org/users/okini3939/notebook/weather-platform/

Dependents:   WeatherStation Wetterstation

Revision:
0:dc42aeff64e6
Child:
1:fa262295fa7e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WeatherMeters.h	Thu Oct 14 11:58:22 2010 +0000
@@ -0,0 +1,44 @@
+/*
+ * mbed library to use a Sparkfun Weather Meters
+ * Copyright (c) 2010 Hiroshi Suga
+ * Released under the MIT License: http://mbed.org/license/mit
+ */
+ 
+#ifndef WeatherMeters_H
+#define WeatherMeters_H
+
+#include "mbed.h"
+
+enum Weather_mode {
+    Weather_manual = 0,
+    Weather_auto = 1
+};
+
+class WeatherMeters : public Base {
+public:
+    WeatherMeters(PinName p_anemometer, PinName p_windvane, PinName p_raingauge, Weather_mode w_mode = Weather_auto);
+
+    float get_windspeed();
+    float get_windvane();
+    float get_raingauge();
+    void update();
+
+protected:
+    void int_anemometer ();
+    void int_raingauge ();
+    void int_timer ();
+
+    InterruptIn int01, int02;
+    AnalogIn ain01;
+    Ticker ticker01;
+    int windspeed, raingauge;
+    float windvane;
+    int mode;
+
+private:
+
+    int count_anemo, count_rain, time_anemo, time_rain;
+    int buf_anemo[12], buf_rain[12];
+};
+
+#endif