本文整理汇总了C++中Weather::setOversampleRate方法的典型用法代码示例。如果您正苦于以下问题:C++ Weather::setOversampleRate方法的具体用法?C++ Weather::setOversampleRate怎么用?C++ Weather::setOversampleRate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weather
的用法示例。
在下文中一共展示了Weather::setOversampleRate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Hardware_Initialize
void Hardware_Initialize()
{
// DS18B20 initialization
sensors.begin();
sensors.setResolution(inSoilThermometer, TEMPERATURE_PRECISION);
pinMode(WSPEED, INPUT_PULLUP); // input from wind meters windspeed sensor
pinMode(RAIN, INPUT_PULLUP); // input from wind meters rain gauge sensor
pinMode(SOIL_MOIST_POWER, OUTPUT); // power control for soil moisture
digitalWrite(SOIL_MOIST_POWER, LOW); // Leave off by defualt
// Setup status LED
pinMode(STATUS_LED, OUTPUT);
digitalWrite(STATUS_LED, LOW);
Serial.begin(9600); // open serial over USB
// Initialize the I2C sensors and ping them
sensor.begin();
//
// You can only receive acurate barrometric readings or acurate altitiude
// readings at a given time, not both at the same time. The following two lines
// tell the sensor what mode to use. You could easily write a function that
// takes a reading in one made and then switches to the other mode to grab that
// reading, resulting in data that contains both acurate altitude and barrometric
// readings. For this example, we will only be using the barometer mode. Be sure
// to only uncomment one line at a time.
//
sensor.setModeBarometer(); // Set to Barometer Mode
//baro.setModeAltimeter(); // Set to altimeter Mode
// These are additional MPL3115A2 functions the MUST be called for the sensor to work.
sensor.setOversampleRate(7); // Set Oversample rate
//
// Call with a rate from 0 to 7. See page 33 for table of ratios.
// Sets the over sample rate. Datasheet calls for 128 but you can set it
// from 1 to 128 samples. The higher the oversample rate the greater
// the time between data samples.
//
sensor.enableEventFlags(); // Necessary register calls to enble temp, baro ansd alt
return;
}