Demo program for the MPL3115A2 library.
Dependencies: FOCOMETROPRESION mbed
Fork of WIGO_MPL3115A2 by
Diff: main.cpp
- Revision:
- 7:97f5edf7d270
- Parent:
- 6:07f92b4716b6
- Child:
- 8:c415332bdea7
diff -r 07f92b4716b6 -r 97f5edf7d270 main.cpp --- a/main.cpp Sun Sep 22 11:18:08 2013 +0000 +++ b/main.cpp Tue Sep 24 20:22:57 2013 +0000 @@ -24,7 +24,7 @@ pc.baud( 230400); pc.printf("MPL3115A2 Sensor. [%X]\r\n", wigo_sensor1.getDeviceID()); -#if 1 +#if 0 // ***** Data acquisition using Interrupt // Configure the sensor as Barometer. @@ -97,6 +97,28 @@ } #endif +#if 1 + // ***** Data acquisition using polling method and delta values + + // Array for the dela values + float delta[2]; + + // Set over sampling value (see MPL3115A2.h for details) + wigo_sensor1.Oversample_Ratio( OVERSAMPLE_RATIO_128); + // Configure the sensor as Barometer. + wigo_sensor1.Barometric_Mode(); + + while(1) { + // + if ( wigo_sensor1.getAllData( &sensor_data[0], &delta[0])) { + pc.printf("\tPressure: %f\tTemperature: %f\r\n", sensor_data[0], sensor_data[1]); + pc.printf("\tDelatPress: %f\tDeltaTemp: %f\r\n", delta[0], delta[1]); + } + // + wait( 1.0); + } +#endif + #if 0 // ***** Data acquisition in RAW mode using polling method