Demo program to connect to MS5803-14BA Pressure Sensor with an I2C connection.
Fork of MS5803-Demo by
Diff: main.cpp
- Revision:
- 1:607dbba0562f
- Parent:
- 0:f0809a7877ff
- Child:
- 2:05edc973aa75
--- a/main.cpp Sat Apr 07 14:18:42 2012 +0000 +++ b/main.cpp Thu Jul 24 04:48:16 2014 +0000 @@ -18,36 +18,40 @@ THE SOFTWARE. * Demo Program - * Barometer Sensor (Altimeter) MS5803-01BA of MEAS Switzerland (www.meas-spec.com). - * The driver uses I2C mode (sensor PS pin low). - * Other types of MEAS are compatible but not tested. - * Written by Raig Kaufer distribute freely! + * for Pressure Sensors of type MS5803-x of MEAS Switzerland (www.meas-spec.com). + * The driver uses I2C mode (sensor's Protocol Select (PS) pin pulled to high). + * MS5803-01BA (Barometer Sensor (Altimeter)) was successfully tested by Raig Kaufer. + * MS5803-14BA (Underwater Pressure Sensor 14 bar) was successfully tested by Robert Katzschmann + * Other types of MEAS are compatible but not tested + * Written by Raig Kaufer, distribute freely! + * Revised by Robert Katzschmann */ #include "mbed.h" #include "MS5803.h" -#include "USBSerial.h" #define debug #ifdef debug -USBSerial serial; + Serial pc(USBTX, USBRX); #endif -MS5803 press_sensor( p9, p10, ms5803_base_addr ); // sda, scl, I2C_address 0x76 or 0x77 look at MS5803.h +MS5803 press_sensor( p9, p10, ms5803_addrCH ); // sda, scl, I2C_address + // I2C_address: ms5803_addrCH (0x76) or ms5803_addrCL (0x77) + // see also at MS5803.h int main() { #ifdef debug wait( 3 ); - serial.printf("MS5803 demo"); + pc.printf("MS5803 demo"); #endif while ( 1 ) { #ifdef debug press_sensor.Barometer_MS5803(); - serial.printf("%4.1f (mBar)\r\n", press_sensor.MS5803_Pressure()); - serial.printf("%4.1f (deg C)\r\n", press_sensor.MS5803_Temperature()); + pc.printf("%4.1f (mBar)\r\n", press_sensor.MS5803_Pressure()); + pc.printf("%4.1f (deg C)\r\n", press_sensor.MS5803_Temperature()); #endif wait( 1 );