display bme280 data on 16x2 character lcd display

Dependencies:   mbed TextLCD BME280

Files at this revision

API Documentation at this revision

Comitter:
skudmunky
Date:
Mon Mar 30 12:40:13 2020 +0000
Parent:
3:710f0b2843e4
Commit message:
display to LCD

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Mon Mar 30 12:40:13 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- a/main.cpp	Fri Jun 26 06:42:06 2015 +0000
+++ b/main.cpp	Mon Mar 30 12:40:13 2020 +0000
@@ -1,5 +1,6 @@
 #include "mbed.h"
 #include "BME280.h"
+#include "TextLCD.h"
 
 Serial pc(USBTX, USBRX);
 
@@ -9,10 +10,13 @@
 BME280 sensor(I2C_SDA, I2C_SCL);
 #endif
 
+TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, rw, e, d4, d5, d6, d7
+
 int main() {
-    
+    sensor.initialize();
     while(1) {
-        pc.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity());
+        lcd.cls();
+        lcd.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity());
         wait(1);
     }
 }