test program for MPL3115A2

Dependencies:   C12832 LM75B MPL3115A2 mbed

Fork of test_MPL3115A2 by MSS

main.cpp

Committer:
Rhyme
Date:
2017-05-18
Revision:
1:4870f310b921
Parent:
0:27799234e2ed
Child:
2:ef315a40af7b

File content as of revision 1:4870f310b921:

#include "mbed.h"
#include "MSS.h"
#include "MPL3115A2.h"
#define MPL3115A2_I2C_ADDRESS (0x60)

int main() {
    double alt, bar, temp ;
    MPL3115A2 mpl(PIN_SDA, PIN_SCL, MPL3115A2_I2C_ADDRESS) ;
    
    printf("=== test MPL3115A2 for %s (%s) ===\n",BOARD_NAME, __DATE__) ;
    printf("Altitude(m), Pressure(hPa),   Temperature(c)\n") ;
    
    while(1) {
        alt = mpl.getAltitude() ;
        bar = mpl.getPressure() ;
        temp = mpl.getTemperature() ;
        printf("%6.2f,   %6.2f, %6.2f\n",alt, bar, temp) ;
        wait(1) ;
    }
}