Toyomasa Watarai
/
BME280_Hello
Hello program for BME280 library
main.cpp@3:710f0b2843e4, 2015-06-26 (annotated)
- Committer:
- MACRUM
- Date:
- Fri Jun 26 06:42:06 2015 +0000
- Revision:
- 3:710f0b2843e4
- Parent:
- 0:2c9585cecfde
- Child:
- 4:5656d9c63801
Library update
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 | } |