display bme280 data on 16x2 character lcd display

Dependencies:   mbed TextLCD BME280

Committer:
skudmunky
Date:
Mon Mar 30 12:40:13 2020 +0000
Revision:
4:65f98aac8e5d
Parent:
0:2c9585cecfde
display to LCD

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"
skudmunky 4:65f98aac8e5d 3 #include "TextLCD.h"
MACRUM 0:2c9585cecfde 4
MACRUM 0:2c9585cecfde 5 Serial pc(USBTX, USBRX);
MACRUM 0:2c9585cecfde 6
MACRUM 0:2c9585cecfde 7 #if defined(TARGET_LPC1768)
MACRUM 0:2c9585cecfde 8 BME280 sensor(p28, p27);
MACRUM 0:2c9585cecfde 9 #else
MACRUM 0:2c9585cecfde 10 BME280 sensor(I2C_SDA, I2C_SCL);
MACRUM 0:2c9585cecfde 11 #endif
MACRUM 0:2c9585cecfde 12
skudmunky 4:65f98aac8e5d 13 TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, rw, e, d4, d5, d6, d7
skudmunky 4:65f98aac8e5d 14
MACRUM 0:2c9585cecfde 15 int main() {
skudmunky 4:65f98aac8e5d 16 sensor.initialize();
MACRUM 0:2c9585cecfde 17 while(1) {
skudmunky 4:65f98aac8e5d 18 lcd.cls();
skudmunky 4:65f98aac8e5d 19 lcd.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity());
MACRUM 0:2c9585cecfde 20 wait(1);
MACRUM 0:2c9585cecfde 21 }
MACRUM 0:2c9585cecfde 22 }