Hello program for BME280 library

Dependencies:   mbed BME280

Committer:
MACRUM
Date:
Sat Nov 07 13:13:47 2020 +0000
Revision:
4:5656d9c63801
Parent:
0:2c9585cecfde
Update libraries

Who changed what in which revision?

UserRevisionLine numberNew 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 4:5656d9c63801 8 #elif defined(TARGET_TY51822R3)
MACRUM 4:5656d9c63801 9 BME280 sensor(P0_30, P0_7);
MACRUM 0:2c9585cecfde 10 #else
MACRUM 4:5656d9c63801 11 BME280 sensor(SDA, SCL);
MACRUM 0:2c9585cecfde 12 #endif
MACRUM 0:2c9585cecfde 13
MACRUM 0:2c9585cecfde 14 int main() {
MACRUM 0:2c9585cecfde 15
MACRUM 0:2c9585cecfde 16 while(1) {
MACRUM 0:2c9585cecfde 17 pc.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity());
MACRUM 0:2c9585cecfde 18 wait(1);
MACRUM 0:2c9585cecfde 19 }
MACRUM 0:2c9585cecfde 20 }