A sample program to use MPL115A2 Library

Dependencies:   MPL115A2 mbed

main.cpp

Committer:
yamaguch
Date:
2011-05-14
Revision:
0:2b7c3fd0488b

File content as of revision 0:2b7c3fd0488b:

#include "mbed.h"
#include "MPL115A2.h"

MPL115A2 mpl115a2(p28, p27);

int main() {
    float pressure;
    char data[16];

    mpl115a2.read(&pressure, data);
    printf("raw data:");
    for (int i = 0; i < sizeof(data); i++) printf(" %02X", data[i]);
    printf("\npressure = %4.0f hPa\n", pressure);
    wait(1);
    
    while (true) {
        printf("pressure = %4.0f hPa\n", mpl115a2.readPressure());
        wait(1);
    }
}