example usage of mpl115a2 library

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "MPL115A2.h"
00003 
00004 I2C i2c(p9, p10);        // sda, scl
00005 Serial pc(USBTX, USBRX); // tx, rx
00006 
00007 // MPL115A2 p_sensor(&i2c, &pc); //DEBUG verion
00008 MPL115A2 p_sensor(&i2c);
00009 
00010 int main() {
00011 
00012     p_sensor.begin();   
00013     
00014     while(1) 
00015     {
00016         
00017         p_sensor.ReadSensor();
00018         pc.printf("Pressure    = %f\n", p_sensor.GetPressure());
00019         wait(1);
00020         pc.printf("Temperature = %f\n", p_sensor.GetTemperature());
00021         wait(1);
00022         
00023         
00024     }
00025 }