example code to display mpl1152a data on a jhd 162a 16x2 lcd display
Dependencies: mbed mpl115a2 BME280_SPI TextLCD
main.cpp
- Committer:
- skudmunky
- Date:
- 2020-03-30
- Revision:
- 2:e1e9cca4d7e3
- Parent:
- 1:f198c37d9f5a
- Child:
- 3:99befa3962d4
File content as of revision 2:e1e9cca4d7e3:
#include "mbed.h" #include "MPL115A2.h" #include "BME280.h" #include "TextLCD.h" I2C i2c(p9, p10); // sda, scl Serial pc(USBTX, USBRX); // tx, rx // MPL115A2 p_sensor(&i2c, &pc); //DEBUG verion MPL115A2 mpl_sensor(&i2c); //BME280 bme_sensor(p28, p27); // sda, scl TextLCD lcd(p24, p25, p26, p27, p28, p29); // rs, rw, e, d4, d5, d6, d7 //TextLCD lcd(p21, p22, p23, p24, p25, p26); // rs, rw, e, d4, d5, d6, d7 int main() { mpl_sensor.begin(); while(1) { mpl_sensor.ReadSensor(); lcd.cls(); // WITHOUT THIS THE ENDLESS BEEP OCCURS lcd.printf("%0.2f hPa\n%0.2f C %\n", mpl_sensor.GetPressure(), mpl_sensor.GetTemperature()); wait(.1); //lcd.cls(); // WITHOUT THIS THE ENDLESS BEEP OCCURS //lcd.printf("%0.2f hPa\n%0.2f C %\n", bme_sensor.getPressure(), bme_sensor.getTemperature()); //wait(1); } }