test program for MPL3115A2

Dependencies:   C12832 LM75B MPL3115A2 mbed

Committer:
Rhyme
Date:
Thu May 18 06:32:59 2017 +0000
Revision:
1:4870f310b921
Parent:
0:27799234e2ed
Child:
2:ef315a40af7b
library was modified to return double value in usual measure, m, hPa, and degree Celsius. And print format etc has been modified to reflect the change(s).

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:27799234e2ed 1 #include "mbed.h"
Rhyme 0:27799234e2ed 2 #include "MSS.h"
Rhyme 0:27799234e2ed 3 #include "MPL3115A2.h"
Rhyme 0:27799234e2ed 4 #define MPL3115A2_I2C_ADDRESS (0x60)
Rhyme 0:27799234e2ed 5
Rhyme 0:27799234e2ed 6 int main() {
Rhyme 1:4870f310b921 7 double alt, bar, temp ;
Rhyme 0:27799234e2ed 8 MPL3115A2 mpl(PIN_SDA, PIN_SCL, MPL3115A2_I2C_ADDRESS) ;
Rhyme 0:27799234e2ed 9
Rhyme 0:27799234e2ed 10 printf("=== test MPL3115A2 for %s (%s) ===\n",BOARD_NAME, __DATE__) ;
Rhyme 1:4870f310b921 11 printf("Altitude(m), Pressure(hPa), Temperature(c)\n") ;
Rhyme 0:27799234e2ed 12
Rhyme 0:27799234e2ed 13 while(1) {
Rhyme 0:27799234e2ed 14 alt = mpl.getAltitude() ;
Rhyme 0:27799234e2ed 15 bar = mpl.getPressure() ;
Rhyme 1:4870f310b921 16 temp = mpl.getTemperature() ;
Rhyme 1:4870f310b921 17 printf("%6.2f, %6.2f, %6.2f\n",alt, bar, temp) ;
Rhyme 0:27799234e2ed 18 wait(1) ;
Rhyme 0:27799234e2ed 19 }
Rhyme 0:27799234e2ed 20 }