version of BME28o test app built using mbed-os 5.4.3 verified working with mDot and sparkfun BN280 module
Fork of BME280_Hello by
main.cpp@5:1d5da5d68064, 2017-04-16 (annotated)
- Committer:
- Roietronics
- Date:
- Sun Apr 16 00:09:05 2017 +0000
- Revision:
- 5:1d5da5d68064
- Parent:
- 0:2c9585cecfde
New version using mbed-os 5.4.3 instead of mbed 2.x
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:2c9585cecfde | 1 | #include "mbed.h" |
MACRUM | 0:2c9585cecfde | 2 | #include "BME280.h" |
MACRUM | 0:2c9585cecfde | 3 | |
MACRUM | 0:2c9585cecfde | 4 | Serial pc(USBTX, USBRX); |
MACRUM | 0:2c9585cecfde | 5 | |
MACRUM | 0:2c9585cecfde | 6 | #if defined(TARGET_LPC1768) |
MACRUM | 0:2c9585cecfde | 7 | BME280 sensor(p28, p27); |
MACRUM | 0:2c9585cecfde | 8 | #else |
MACRUM | 0:2c9585cecfde | 9 | BME280 sensor(I2C_SDA, I2C_SCL); |
MACRUM | 0:2c9585cecfde | 10 | #endif |
MACRUM | 0:2c9585cecfde | 11 | |
MACRUM | 0:2c9585cecfde | 12 | int main() { |
MACRUM | 0:2c9585cecfde | 13 | |
MACRUM | 0:2c9585cecfde | 14 | while(1) { |
MACRUM | 0:2c9585cecfde | 15 | pc.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity()); |
MACRUM | 0:2c9585cecfde | 16 | wait(1); |
MACRUM | 0:2c9585cecfde | 17 | } |
MACRUM | 0:2c9585cecfde | 18 | } |