This program is for Cansat made with BreadBoard which have pressure sensor LPS331. This program is based on http://mbed.org/users/nyamfg/code/LPS331_HelloWorld/

Dependencies:   mbed

Revision:
2:70ce034cfcfc
Parent:
0:1a3c5ad01539
Child:
3:cb51cc4a041d
--- a/main.cpp	Sun Oct 20 15:28:04 2013 +0000
+++ b/main.cpp	Mon Oct 21 16:41:09 2013 +0000
@@ -15,7 +15,7 @@
     }
     
     lps331.setResolution(LPS331_I2C_PRESSURE_AVG_512, LPS331_I2C_TEMP_AVG_128);
-    lps331.setDataRate(LPS331_I2C_DATARATE_1HZ);
+    lps331.setDataRate(LPS331_I2C_DATARATE_7HZ);
     lps331.setActive(true);
     
     pc.printf("LPS331 Register map.\r\n");
@@ -28,6 +28,20 @@
         }
         pc.printf("\r\n");
     }
+    
+    pc.printf("LPS331 Register map(multibyte read test).\r\n");
+    
+    for(int i = 0; i < 8; i++) {
+        char data[16];
+        lps331._read_multibyte(i << 4, data, 16);
+        pc.printf("%02x: ", i);
+        for(int j = 0; j < 16; j++) {
+            pc.printf("%02x ", data[j]);
+        }
+        pc.printf("\r\n");
+    }
+    
+    wait(2.0);
                 
     while(true) {
         float pres, temp;
@@ -35,9 +49,9 @@
         pres = lps331.getPressure();
         temp = lps331.getTemperature();
         
-        pc.printf("Pressure = %4.2f hPa, Temp = %2.2f C.\r\n", pres, temp);
+        pc.printf("%f,%f\r\n", pres, temp);
         
-        wait(1);
+        wait(1/7.0);
     }
 
 }