Demo of the sample LCD class, BMP280 Sensor and network with power on self test. Requires a network connectionb
Dependencies: BMP280 TextLCD BME280
Diff: main.cpp
- Revision:
- 0:36e89e3ed7c4
- Child:
- 1:e1cf7663f5ff
diff -r 000000000000 -r 36e89e3ed7c4 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Sep 13 11:03:52 2017 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+//#define BME
+#ifdef BME
+#include "BME280.h"
+#else
+#include "BMP280.h"
+#endif
+
+//LCD Driver
+//RS D9
+//E D8
+//D7,6,4,2 are the 4 bit for d4-7
+TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4-d7
+
+//Sensor driver
+#ifdef BME
+BME280 sensor(D14, D15);
+#else
+BMP280 sensor(D14, D15);
+#endif
+
+int main() {
+
+ while(1) {
+ double temp = sensor.getTemperature();
+ double pressure = sensor.getPressure();
+ lcd.printf("Temp Pressure\n");
+ lcd.printf("%6.1f ",temp);
+ lcd.printf("%.2f\n",pressure);
+ wait(2.0);
+ }
+}
+
Nicholas Outram