Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /* 00002 Permission is hereby granted, free of charge, to any person obtaining a copy 00003 of this software and associated documentation files (the "Software"), to deal 00004 in the Software without restriction, including without limitation the rights 00005 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00006 copies of the Software, and to permit persons to whom the Software is 00007 furnished to do so, subject to the following conditions: 00008 00009 The above copyright notice and this permission notice shall be included in 00010 all copies or substantial portions of the Software. 00011 00012 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00013 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00014 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00015 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00016 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00017 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00018 THE SOFTWARE. 00019 00020 * Demo Program 00021 * Barometer Sensor (Altimeter) MS5803-01BA of MEAS Switzerland (www.meas-spec.com). 00022 * The driver uses I2C mode (sensor PS pin low). 00023 * Other types of MEAS are compatible but not tested. 00024 * Written by Raig Kaufer distribute freely! 00025 */ 00026 00027 #include "mbed.h" 00028 #include "MS5803.h" 00029 #include "USBSerial.h" 00030 00031 #define debug 00032 #ifdef debug 00033 USBSerial serial; 00034 Serial pc(USBTX, USBRX); 00035 #endif 00036 00037 MS5803 press_sensor( p9, p10, ms5803_base_addr ); // sda, scl, I2C_address 0x76 or 0x77 look at MS5803.h 00038 00039 int main() { 00040 00041 #ifdef debug 00042 wait( 3 ); 00043 serial.printf("MS5803 demo"); 00044 #endif 00045 00046 while ( 1 ) { 00047 #ifdef debug 00048 press_sensor.Barometer_MS5803(); 00049 serial.printf("%4.1f (mBar)\r\n", press_sensor.MS5803_Pressure()); 00050 serial.printf("%4.1f (deg C)\r\n", press_sensor.MS5803_Temperature()); 00051 #endif 00052 00053 wait( 1 ); 00054 } 00055 }
Generated on Wed Jul 13 2022 02:23:24 by
1.7.2