joe holdsworth
/
mpl115a2_example
example usage of mpl115a2 library
main.cpp@0:118187295473, 2012-05-07 (annotated)
- Committer:
- joeh
- Date:
- Mon May 07 13:27:04 2012 +0000
- Revision:
- 0:118187295473
- Child:
- 1:f198c37d9f5a
beta version of mpl115a2 test program
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:118187295473 | 6 | MPL115A2 p_sensor(&i2c, &pc); |
joeh | 0:118187295473 | 7 | |
joeh | 0:118187295473 | 8 | int main() { |
joeh | 0:118187295473 | 9 | |
joeh | 0:118187295473 | 10 | p_sensor.begin(); |
joeh | 0:118187295473 | 11 | |
joeh | 0:118187295473 | 12 | while(1) |
joeh | 0:118187295473 | 13 | { |
joeh | 0:118187295473 | 14 | p_sensor.ReadSensor(); |
joeh | 0:118187295473 | 15 | pc.printf("Pressure = %f\n", p_sensor.GetPressure()); |
joeh | 0:118187295473 | 16 | wait(1); |
joeh | 0:118187295473 | 17 | pc.printf("Temperature = %f\n", p_sensor.GetTemperature()); |
joeh | 0:118187295473 | 18 | wait(1); |
joeh | 0:118187295473 | 19 | } |
joeh | 0:118187295473 | 20 | } |