display bme280 data on 16x2 character lcd display
Dependencies: mbed TextLCD BME280
main.cpp@0:2c9585cecfde, 2015-04-06 (annotated)
- Committer:
- MACRUM
- Date:
- Mon Apr 06 09:13:14 2015 +0000
- Revision:
- 0:2c9585cecfde
- Child:
- 4:65f98aac8e5d
Initial release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:2c9585cecfde | 1 | #include "mbed.h" |
MACRUM | 0:2c9585cecfde | 2 | #include "BME280.h" |
MACRUM | 0:2c9585cecfde | 3 | |
MACRUM | 0:2c9585cecfde | 4 | Serial pc(USBTX, USBRX); |
MACRUM | 0:2c9585cecfde | 5 | |
MACRUM | 0:2c9585cecfde | 6 | #if defined(TARGET_LPC1768) |
MACRUM | 0:2c9585cecfde | 7 | BME280 sensor(p28, p27); |
MACRUM | 0:2c9585cecfde | 8 | #else |
MACRUM | 0:2c9585cecfde | 9 | BME280 sensor(I2C_SDA, I2C_SCL); |
MACRUM | 0:2c9585cecfde | 10 | #endif |
MACRUM | 0:2c9585cecfde | 11 | |
MACRUM | 0:2c9585cecfde | 12 | int main() { |
MACRUM | 0:2c9585cecfde | 13 | |
MACRUM | 0:2c9585cecfde | 14 | while(1) { |
MACRUM | 0:2c9585cecfde | 15 | pc.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity()); |
MACRUM | 0:2c9585cecfde | 16 | wait(1); |
MACRUM | 0:2c9585cecfde | 17 | } |
MACRUM | 0:2c9585cecfde | 18 | } |