sensor

Dependents:   enviro_copy

Revision:
3:d4eb81284ea0
Parent:
2:c35f637c28ef
Child:
4:ddcaa259e65b
diff -r c35f637c28ef -r d4eb81284ea0 BME280.cpp
--- a/BME280.cpp	Sat Apr 11 15:47:58 2015 +0000
+++ b/BME280.cpp	Tue May 12 12:07:25 2015 +0000
@@ -108,15 +108,15 @@
  
     cmd[0] = 0xfa; // temp_msb
     i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[1], 1);
+    i2c.read(address, &cmd[1], 3);
  
-    cmd[0] = 0xfb; // temp_lsb
-    i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[2], 1);
+    //cmd[0] = 0xfb; // temp_lsb
+    //i2c.write(address, cmd, 1);
+    //i2c.read(address, &cmd[2], 1);
  
-    cmd[0] = 0xfc; // temp_xlsb
-    i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[3], 1);
+    //cmd[0] = 0xfc; // temp_xlsb
+    //i2c.write(address, cmd, 1);
+    //i2c.read(address, &cmd[3], 1);
  
     temp_raw = (cmd[1] << 12) | (cmd[2] << 4) | (cmd[3] >> 4);
  
@@ -141,15 +141,15 @@
  
     cmd[0] = 0xf7; // press_msb
     i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[1], 1);
+    i2c.read(address, &cmd[1], 3);
  
-    cmd[0] = 0xf8; // press_lsb
-    i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[2], 1);
+    //cmd[0] = 0xf8; // press_lsb
+    //i2c.write(address, cmd, 1);
+    //i2c.read(address, &cmd[2], 1);
  
-    cmd[0] = 0xf9; // press_xlsb
-    i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[3], 1);
+    //cmd[0] = 0xf9; // press_xlsb
+    //i2c.write(address, cmd, 1);
+    //i2c.read(address, &cmd[3], 1);
  
     press_raw = (cmd[1] << 12) | (cmd[2] << 4) | (cmd[3] >> 4);
  
@@ -187,11 +187,11 @@
  
     cmd[0] = 0xfd; // hum_msb
     i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[1], 1);
+    i2c.read(address, &cmd[1], 2);
  
-    cmd[0] = 0xfd; // hum_lsb
-    i2c.write(address, cmd, 1);
-    i2c.read(address, &cmd[2], 1);
+    //cmd[0] = 0xfe; // hum_lsb
+    //i2c.write(address, cmd, 1);
+    //i2c.read(address, &cmd[2], 1);
  
     hum_raw = (cmd[1] << 8) | cmd[2];