Liam Grazier
/
0NicksCoursework-lg
diajzifsajoifajsoifaj
Fork of ELEC350-CWTEMPLATE-2017 by
Diff: main.cpp
- Revision:
- 0:36e89e3ed7c4
- Child:
- 1:e1cf7663f5ff
--- /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); + } +} +