Library for getting temperature and pressure values from Bosch BMP180 barometer.
Fork of BMP180 by
Diff: BMP180.h
- Revision:
- 1:e6c317e0f3a4
- Parent:
- 0:70d1d5ec30c8
- Child:
- 2:79d0d565c3af
diff -r 70d1d5ec30c8 -r e6c317e0f3a4 BMP180.h --- a/BMP180.h Sun Mar 08 16:11:49 2015 +0000 +++ b/BMP180.h Sun Mar 08 16:14:36 2015 +0000 @@ -53,6 +53,30 @@ * Example: * @code +#include "mbed.h" +#include "BMP180.h" + +BMP180 bmp180(p28,p27); // SDA, SCL +Serial serial(USBTX,USBRX); + +int main() { + + // initiliase barometer + bmp180.init(); + + Measurement measurement; // measurement structure declared in BMP180 class + + while(1) { + + // read values (T in Celsius and P in mb) and print over serial port + measurement = bmp180.readValues(); + serial.printf("T = %.2f C P = %.2f mb\n",measurement.temperature,measurement.pressure); + wait(1.0); // short delau until next reading + + } +} + + * @endcode */ @@ -67,7 +91,7 @@ * */ BMP180(PinName sdaPin, PinName sclPin); - + /** Initialise barometer - reads factory calibration data * */