example usage of mpl115a2 library

Dependencies:   mbed

main.cpp

Committer:
joeh
Date:
2012-05-07
Revision:
1:f198c37d9f5a
Parent:
0:118187295473

File content as of revision 1:f198c37d9f5a:

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

I2C i2c(p9, p10);        // sda, scl
Serial pc(USBTX, USBRX); // tx, rx

// MPL115A2 p_sensor(&i2c, &pc); //DEBUG verion
MPL115A2 p_sensor(&i2c);

int main() {

    p_sensor.begin();   
    
    while(1) 
    {
        
        p_sensor.ReadSensor();
        pc.printf("Pressure    = %f\n", p_sensor.GetPressure());
        wait(1);
        pc.printf("Temperature = %f\n", p_sensor.GetTemperature());
        wait(1);
        
        
    }
}