example usage of mpl115a2 library

Dependencies:   mbed

Committer:
joeh
Date:
Mon May 07 13:28:43 2012 +0000
Revision:
1:f198c37d9f5a
Parent:
0:118187295473
made default version none debug

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joeh 0:118187295473 1 #include "mbed.h"
joeh 0:118187295473 2 #include "MPL115A2.h"
joeh 0:118187295473 3
joeh 0:118187295473 4 I2C i2c(p9, p10); // sda, scl
joeh 0:118187295473 5 Serial pc(USBTX, USBRX); // tx, rx
joeh 1:f198c37d9f5a 6
joeh 1:f198c37d9f5a 7 // MPL115A2 p_sensor(&i2c, &pc); //DEBUG verion
joeh 1:f198c37d9f5a 8 MPL115A2 p_sensor(&i2c);
joeh 0:118187295473 9
joeh 0:118187295473 10 int main() {
joeh 0:118187295473 11
joeh 0:118187295473 12 p_sensor.begin();
joeh 0:118187295473 13
joeh 0:118187295473 14 while(1)
joeh 0:118187295473 15 {
joeh 1:f198c37d9f5a 16
joeh 0:118187295473 17 p_sensor.ReadSensor();
joeh 0:118187295473 18 pc.printf("Pressure = %f\n", p_sensor.GetPressure());
joeh 0:118187295473 19 wait(1);
joeh 0:118187295473 20 pc.printf("Temperature = %f\n", p_sensor.GetTemperature());
joeh 0:118187295473 21 wait(1);
joeh 1:f198c37d9f5a 22
joeh 1:f198c37d9f5a 23
joeh 0:118187295473 24 }
joeh 0:118187295473 25 }