Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of 0NicksCoursework_copywithserialtime by
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);
+ }
+}
+
