this library is designed for a falling sensor, if you need more information, please check the BMP280 data sheet .

Dependents:   OBC3_1_h ticker1

Fork of BMP280 by Edwin Cho

Files at this revision

API Documentation at this revision

Comitter:
FannyCalle
Date:
Mon May 21 15:11:06 2018 +0000
Parent:
7:c72b726c7dc9
Commit message:
configurado para mis requerimientos

Changed in this revision

BMP280.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/BMP280.cpp	Tue Apr 19 02:03:35 2016 +0000
+++ b/BMP280.cpp	Mon May 21 15:11:06 2018 +0000
@@ -45,16 +45,17 @@
 {
     char cmd[18];
  
-    cmd[0] = 0xf2; // ctrl_hum
-    cmd[1] = 0x01; // Humidity oversampling x1
-    i2c.write(address, cmd, 2);
+    //cmd[0] = 0xf2; // ctrl_hum
+    //cmd[1] = 0x01; // Humidity oversampling x1
+    //i2c.write(address, cmd, 2);
  
     cmd[0] = 0xf4; // ctrl_meas
-    cmd[1] = 0x27; // Temparature oversampling x1, Pressure oversampling x1, Normal mode
+    cmd[1] = 0x2B; // Temparature oversampling x1, Pressure oversampling x1, Normal mode
     i2c.write(address, cmd, 2);
  
     cmd[0] = 0xf5; // config
-    cmd[1] = 0xa0; // Standby 1000ms, Filter off
+    cmd[1] = 0x00; // Standby 1000ms, Filter off ///
+    //CON FILTRO 2 ...
     i2c.write(address, cmd, 2);
  
     cmd[0] = 0x88; // read dig_T regs
@@ -82,24 +83,7 @@
     dig_P9 = (cmd[17] << 8) | cmd[16];
  
     DEBUG_PRINT("dig_P = 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", dig_P1, dig_P2, dig_P3, dig_P4, dig_P5, dig_P6, dig_P7, dig_P8, dig_P9);
- 
-  /*  cmd[0] = 0xA1; // read dig_H regs
-    i2c.write(address, cmd, 1);
-    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[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);
-*/
-}
+ }
  
 float BMP280::getTemperature()
 {
@@ -112,13 +96,13 @@
     i2c.read(address, &cmd[1], 3);
  
     temp_raw = (cmd[1] << 12) | (cmd[2] << 4) | (cmd[3] >> 4);
- 
+    //printf("tem b: %d\n",temp_raw);
     int32_t temp;
  
     temp =
         (((((temp_raw >> 3) - (dig_T1 << 1))) * dig_T2) >> 11) +
         ((((((temp_raw >> 4) - dig_T1) * ((temp_raw >> 4) - dig_T1)) >> 12) * dig_T3) >> 14);
- 
+    //printf("%d\n",temp_raw);
     t_fine = temp;
     temp = (temp * 5 + 128) >> 8;
     tempf = (float)temp;
@@ -131,7 +115,7 @@
     uint32_t press_raw;
     float pressf;
     char cmd[4];
- 
+    
     cmd[0] = 0xf7; // press_msb
     i2c.write(address, cmd, 1);
     i2c.read(address, &cmd[1], 3);