当前位置: 首页>>代码示例>>C++>>正文


C++ Weather::setModeBarometer方法代码示例

本文整理汇总了C++中Weather::setModeBarometer方法的典型用法代码示例。如果您正苦于以下问题:C++ Weather::setModeBarometer方法的具体用法?C++ Weather::setModeBarometer怎么用?C++ Weather::setModeBarometer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Weather的用法示例。


在下文中一共展示了Weather::setModeBarometer方法的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;
}
开发者ID:menloparkinnovation,项目名称:openpux,代码行数:49,代码来源:SparkFun_Photon_Weather_Menlo.cpp


注:本文中的Weather::setModeBarometer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。