Toyomasa Watarai / Mbed 2 deprecated BME280_LCD

Dependencies:   BME280 SB1602E mbed

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Tue Apr 07 05:06:28 2015 +0000
Child:
1:29fb6e4defc8
Commit message:
BME280 example code

Changed in this revision

BME280.lib Show annotated file Show diff for this revision Revisions of this file
SB1602E.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BME280.lib	Tue Apr 07 05:06:28 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/MACRUM/code/BME280/#763a4018aaec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SB1602E.lib	Tue Apr 07 05:06:28 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/MACRUM/code/SB1602E/#baf578069dfc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 07 05:06:28 2015 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "SB1602E.h"
+#include "BME280.h"
+
+SB1602E lcd(I2C_SDA, I2C_SCL);
+BME280 sensor(I2C_SDA, I2C_SCL);
+DigitalIn btn(dp15);
+
+int main()
+{
+    lcd.setCharsInLine(8);
+    lcd.contrast(0x30);
+    int last_mode = 0;
+    btn.mode(PullUp);
+
+    lcd.printf(0, 0, "BME280");
+    lcd.printf(0, 1, "Demo");
+    wait(5);
+    
+    while(1) {
+        if (btn == 1) {
+            if (last_mode == 0)
+                lcd.clear();
+            lcd.printf(0, 0, "%2.2f%cC", sensor.getTemperature(), 0xdf);
+            lcd.printf(0, 1, "%2.2f%%", sensor.getHumidity());
+            last_mode = 1;
+        }
+        else {
+            if (last_mode == 1)
+                lcd.clear();
+            lcd.printf(0, 0, "%2.2f%cC", sensor.getTemperature(), 0xdf);
+            lcd.printf(0, 1, "%04.1fhPa", sensor.getPressure());
+            last_mode = 0;            
+        }
+        wait(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 07 05:06:28 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file