Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of WeatherMeters by
WeatherMeters.h
00001 /* 00002 * mbed library to use a Sparkfun Weather Meters 00003 * Copyright (c) 2011 Hiroshi Suga 00004 * Released under the MIT License: http://mbed.org/license/mit 00005 */ 00006 00007 /** @file WeatherMeters.h 00008 * @brief mbed library to use a Sparkfun Weather Meters 00009 * Anemometer, Wind vane, Rain gauge 00010 * interface: digital, analog 00011 */ 00012 00013 #ifndef WeatherMeters_H 00014 #define WeatherMeters_H 00015 00016 #include "mbed.h" 00017 00018 /** 00019 * @brief parameter of Anemometer 00020 */ 00021 enum Weather_mode { 00022 Weather_manual = 0, 00023 Weather_auto = 1 00024 }; 00025 00026 /** 00027 * @brief WeatherMeters class 00028 */ 00029 class WeatherMeters : public Base { 00030 public: 00031 WeatherMeters(PinName p_anemometer, PinName p_windvane, PinName p_raingauge, Weather_mode w_mode = Weather_auto); 00032 00033 float get_windspeed(); 00034 float get_windvane(); 00035 float get_raingauge(); 00036 void update(); 00037 00038 protected: 00039 void int_anemometer (); 00040 void int_raingauge (); 00041 void int_timer (); 00042 00043 InterruptIn int01, int02; 00044 AnalogIn ain01; 00045 Ticker ticker01; 00046 int windspeed, raingauge; 00047 float windvane; 00048 int mode; 00049 00050 private: 00051 00052 int count_anemo, count_rain, time_anemo, time_rain; 00053 int buf_anemo[12], buf_rain[12]; 00054 }; 00055 00056 #endif
Generated on Thu Jul 21 2022 06:05:44 by
1.7.2
