mirror of
https://github.com/adafruit/Adafruit-BMP085-Library.git
synced 2026-09-22 18:36:51 +00:00
Added ID check to begin()
This commit is contained in:
1 parent
f9119a841f
commit
f4f02f46eb
3 files changed
+8
-3
No files matched your search
+3
-1
@@ -21,13 +21,15 @@ Adafruit_BMP085::Adafruit_BMP085() {
|
||||
}
|
||||
|
||||
|
||||
void Adafruit_BMP085::begin(uint8_t mode) {
|
||||
boolean Adafruit_BMP085::begin(uint8_t mode) {
|
||||
if (mode > BMP085_ULTRAHIGHRES)
|
||||
mode = BMP085_ULTRAHIGHRES;
|
||||
oversampling = mode;
|
||||
|
||||
Wire.begin();
|
||||
|
||||
if (read8(0xD0) != 0x55) return false;
|
||||
|
||||
/* read calibration data */
|
||||
ac1 = read16(BMP085_CAL_AC1);
|
||||
ac2 = read16(BMP085_CAL_AC2);
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@
|
||||
class Adafruit_BMP085 {
|
||||
public:
|
||||
Adafruit_BMP085();
|
||||
void begin(uint8_t mode = BMP085_ULTRAHIGHRES); // by default go highres
|
||||
boolean begin(uint8_t mode = BMP085_ULTRAHIGHRES); // by default go highres
|
||||
float readTemperature(void);
|
||||
int32_t readPressure(void);
|
||||
float readAltitude(float sealevelPressure = 101325); // std atmosphere
|
||||
|
||||
@@ -28,7 +28,10 @@ Adafruit_BMP085 bmp;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
bmp.begin();
|
||||
if (!bmp.begin()) {
|
||||
Serial.println("Could not find a valid BMP085 sensor, check wiring!");
|
||||
while (1) {}
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Reference in new issue
Block a user