Library for Bosch BMP280 temperature and pressure sensor

Dependents:   ELEC350-LCD-DEMO ELEC350-CWTEMPLATE-2017 ELEC351_v1 ELEC350-CWTEMPLATE-2017 ... more

Fork of BMP280 by Edwin Cho

Library for Temperature and Pressure Sensor Bosch BMP280.

Breakoutboard for example from Adafruit

https://learn.adafruit.com/adafruit-bmp280-barometric-pressure-plus-temperature-sensor-breakout/overview

/media/uploads/charly/bmp280.jpg

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Sat Apr 11 15:47:58 2015 +0000
Parent:
1:763a4018aaec
Child:
3:d4eb81284ea0
Commit message:
Fix correction of trimming parameters for humidity

Changed in this revision

BME280.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/BME280.cpp	Mon Apr 06 09:19:41 2015 +0000
+++ b/BME280.cpp	Sat Apr 11 15:47:58 2015 +0000
@@ -85,14 +85,17 @@
  
     cmd[0] = 0xA1; // read dig_H regs
     i2c.write(address, cmd, 1);
-    i2c.read(address, cmd, 9);
- 
+    i2c.read(address, cmd, 1);
+     cmd[1] = 0xE1; // read dig_H regs
+    i2c.write(address, &cmd[1], 1);
+    i2c.read(address, &cmd[1], 7);
+
     dig_H1 = cmd[0];
     dig_H2 = (cmd[2] << 8) | cmd[1];
     dig_H3 = cmd[3];
     dig_H4 = (cmd[4] << 4) | (cmd[5] & 0x0f);
-    dig_H5 = (cmd[7] << 4) | ((cmd[6]>>4) & 0x0f);
-    dig_H6 = cmd[8];
+    dig_H5 = (cmd[6] << 4) | ((cmd[5]>>4) & 0x0f);
+    dig_H6 = cmd[7];
  
     DEBUG_PRINT("dig_H = 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", dig_H1, dig_H2, dig_H3, dig_H4, dig_H5, dig_H6);
 }