Demo of the sample LCD class, BMP280 Sensor and network with power on self test. Requires a network connectionb

Dependencies:   BMP280 TextLCD BME280

Committer:
noutram
Date:
Wed Sep 13 11:03:52 2017 +0000
Revision:
0:36e89e3ed7c4
Child:
1:e1cf7663f5ff
First prototype

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 0:36e89e3ed7c4 1 #include "mbed.h"
noutram 0:36e89e3ed7c4 2 #include "TextLCD.h"
noutram 0:36e89e3ed7c4 3
noutram 0:36e89e3ed7c4 4 //#define BME
noutram 0:36e89e3ed7c4 5 #ifdef BME
noutram 0:36e89e3ed7c4 6 #include "BME280.h"
noutram 0:36e89e3ed7c4 7 #else
noutram 0:36e89e3ed7c4 8 #include "BMP280.h"
noutram 0:36e89e3ed7c4 9 #endif
noutram 0:36e89e3ed7c4 10
noutram 0:36e89e3ed7c4 11 //LCD Driver
noutram 0:36e89e3ed7c4 12 //RS D9
noutram 0:36e89e3ed7c4 13 //E D8
noutram 0:36e89e3ed7c4 14 //D7,6,4,2 are the 4 bit for d4-7
noutram 0:36e89e3ed7c4 15 TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4-d7
noutram 0:36e89e3ed7c4 16
noutram 0:36e89e3ed7c4 17 //Sensor driver
noutram 0:36e89e3ed7c4 18 #ifdef BME
noutram 0:36e89e3ed7c4 19 BME280 sensor(D14, D15);
noutram 0:36e89e3ed7c4 20 #else
noutram 0:36e89e3ed7c4 21 BMP280 sensor(D14, D15);
noutram 0:36e89e3ed7c4 22 #endif
noutram 0:36e89e3ed7c4 23
noutram 0:36e89e3ed7c4 24 int main() {
noutram 0:36e89e3ed7c4 25
noutram 0:36e89e3ed7c4 26 while(1) {
noutram 0:36e89e3ed7c4 27 double temp = sensor.getTemperature();
noutram 0:36e89e3ed7c4 28 double pressure = sensor.getPressure();
noutram 0:36e89e3ed7c4 29 lcd.printf("Temp Pressure\n");
noutram 0:36e89e3ed7c4 30 lcd.printf("%6.1f ",temp);
noutram 0:36e89e3ed7c4 31 lcd.printf("%.2f\n",pressure);
noutram 0:36e89e3ed7c4 32 wait(2.0);
noutram 0:36e89e3ed7c4 33 }
noutram 0:36e89e3ed7c4 34 }
noutram 0:36e89e3ed7c4 35