Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1993 | - | 1 | /* |
2 | MS561101BA_demo.pde - Example code for using the MS561101BA library. |
||
3 | Displays temperature and pression readings from the sensor |
||
4 | |||
5 | Copyright (C) 2011 Fabio Varesano <fvaresano@yahoo.it> |
||
6 | |||
7 | Development of this code has been supported by the Department of Computer Science, |
||
8 | Universita' degli Studi di Torino, Italy within the Piemonte Project |
||
9 | http://www.piemonte.di.unito.it/ |
||
10 | |||
11 | |||
12 | This program is free software: you can redistribute it and/or modify |
||
13 | it under the terms of the version 3 GNU General Public License as |
||
14 | published by the Free Software Foundation. |
||
15 | |||
16 | This program is distributed in the hope that it will be useful, |
||
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
19 | GNU General Public License for more details. |
||
20 | |||
21 | You should have received a copy of the GNU General Public License |
||
22 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
23 | |||
24 | */ |
||
25 | |||
26 | |||
27 | //#define DEBUG_V |
||
28 | |||
29 | #include <Wire.h> |
||
30 | //#include <DebugUtils.h> |
||
31 | #include <MS561101BA.h> |
||
32 | |||
33 | MS561101BA baro = MS561101BA(); |
||
34 | |||
35 | void setup() { |
||
36 | Wire.begin(); |
||
37 | Serial.begin(115200); |
||
38 | delay(1000); |
||
39 | |||
40 | // Suppose that the CSB pin is connected to GND. |
||
41 | // You'll have to check this on your breakout schematics |
||
42 | baro.init(MS561101BA_ADDR_CSB_LOW); |
||
43 | } |
||
44 | |||
45 | void loop() { |
||
46 | Serial.print(" temp: "); |
||
47 | Serial.print(baro.getTemperature(MS561101BA_OSR_4096)); |
||
48 | Serial.print(" degC pres: "); |
||
49 | Serial.print(baro.getPressure(MS561101BA_OSR_4096)); |
||
50 | Serial.println(" mbar"); |
||
51 | } |