Hello program for BME280 library

Dependencies:   BME280 mbed

Fork of BME280_Hello by Toyomasa Watarai

Committer:
hank51017
Date:
Mon Jun 20 07:11:29 2016 +0000
Revision:
4:206a558ebb2a
Parent:
0:2c9585cecfde
bme280 share

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 0:2c9585cecfde 8 #else
MACRUM 0:2c9585cecfde 9 BME280 sensor(I2C_SDA, I2C_SCL);
MACRUM 0:2c9585cecfde 10 #endif
MACRUM 0:2c9585cecfde 11
hank51017 4:206a558ebb2a 12
MACRUM 0:2c9585cecfde 13 int main() {
MACRUM 0:2c9585cecfde 14
hank51017 4:206a558ebb2a 15
MACRUM 0:2c9585cecfde 16 while(1) {
hank51017 4:206a558ebb2a 17
hank51017 4:206a558ebb2a 18 printf("%2.2f degC, %04.2f hPa, %2.2f %%\r\n", (sensor.getTemperature()-32)*5.0/9.0, sensor.getPressure(), sensor.getHumidity());
MACRUM 0:2c9585cecfde 19 wait(1);
MACRUM 0:2c9585cecfde 20 }
MACRUM 0:2c9585cecfde 21 }