本文整理汇总了C++中Weather::getRH方法的典型用法代码示例。如果您正苦于以下问题:C++ Weather::getRH方法的具体用法?C++ Weather::getRH怎么用?C++ Weather::getRH使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weather
的用法示例。
在下文中一共展示了Weather::getRH方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getWeather
void getWeather()
{
// Measure Relative Humidity from the HTU21D or Si7021
humidity = sensor.getRH();
// Measure Temperature from the HTU21D or Si7021
tempf = sensor.getTempF();
//
// Temperature is measured every time RH is requested.
// It is faster, therefore, to read it from previous RH
// measurement with getTemp() instead with readTemp()
//
// Measure the Barometer temperature in F from the MPL3115A2
baroTemp = sensor.readBaroTempF();
// Measure Pressure from the MPL3115A2
pascals = sensor.readPressure();
// If in altitude mode, you can get a reading in feet with this line:
//altf = sensor.readAltitudeFt();
getSoilTemp(); // Read the DS18B20 waterproof temp sensor
getSoilMositure(); // Read the soil moisture sensor
// Calc winddir
winddir = get_wind_direction();
// Calc windspeed
windspeedmph = get_wind_speed();
// Calc windgustmph
// Calc windgustdir
// Report the largest windgust today
windgustmph = 0;
windgustdir = 0;
// Calc windspdmph_avg2m
float temp = 0;
for(int i = 0 ; i < 120 ; i++) {
temp += windspdavg[i];
}
temp /= 120.0;
windspdmph_avg2m = temp;
// Calc winddir_avg2m
temp = 0; // Can't use winddir_avg2m because it's an int
for(int i = 0 ; i < 120 ; i++) {
temp += winddiravg[i];
}
temp /= 120;
winddir_avg2m = temp;
//
// Calc windgustmph_10m
// Calc windgustdir_10m
// Find the largest windgust in the last 10 minutes
//
windgustmph_10m = 0;
windgustdir_10m = 0;
// Step through the 10 minutes
for(int i = 0; i < 10 ; i++)
{
if(windgust_10m[i] > windgustmph_10m)
{
windgustmph_10m = windgust_10m[i];
windgustdir_10m = windgustdirection_10m[i];
}
}
//
// Total rainfall for the day is calculated within the interrupt
// Calculate amount of rainfall for the last 60 minutes
//
rainin = 0;
for(int i = 0 ; i < 60 ; i++) {
rainin += rainHour[i];
}
}