BMP085を入れました

Dependencies:   BMP085_2 SDFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
yattu0914
Date:
Mon May 19 09:33:42 2014 +0000
Parent:
6:3cc5c120fbe3
Commit message:
test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3cc5c120fbe3 -r ba3fa64f04e9 main.cpp
--- a/main.cpp	Thu Aug 01 11:18:50 2013 +0000
+++ b/main.cpp	Mon May 19 09:33:42 2014 +0000
@@ -6,7 +6,7 @@
 //SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
 Serial xbee(p13,p14);  // tx, rx 
 /*Timeout dater;*/
-//LocalFileSystem local("local");
+LocalFileSystem local("local");
 Timer timer;
 
 AnalogIn temp_in(p20);
@@ -26,7 +26,7 @@
     float vo,ax,ay,az, light,P,t; 
 
     FILE* fp = NULL;
-  //  fp = fopen("/local/CanSat.txt", "a");
+    fp = fopen("/local/CanSat.txt", "a");
     unsigned count = 0;
 
    
@@ -84,36 +84,39 @@
         if (fp != NULL) {
             fprintf(fp, "S %f ", seconds);
             fprintf(fp, "T %5.2f ",r_temp);
-            fprintf(fp, "H %5.2f ",(vo*8-6)/25);
-            fprintf(fp, "X %5.2f ",(ax*33-1.65)/0.66);
-            fprintf(fp, "Y %5.2f ",(ay*33-1.65)/0.66);
-            fprintf(fp, "Z %5.2f ",(az*33-1.65)/0.66);
+            fprintf(fp, "H %5.2f ",(vo*8-6)/25+0.06);
+//            fprintf(fp, "X %5.2f ",(ax*33-1.65)/0.66);
+//            fprintf(fp, "Y %5.2f ",(ay*33-1.65)/0.66);
+//            fprintf(fp, "Z %5.2f ",(az*33-1.65)/0.66);
+             accelerometer.getOutput(readings);
+             fprintf(fp,"X %+4.2f, Y %+4.2f, Z %+4.2f ",
+             (float((int16_t)readings[0]+18)/256-0.12), 
+             (float((int16_t)readings[1]-4 )/256-0.03), 
+             (float((int16_t)readings[2]+22)/256+0.12));
             fprintf(fp, "L %5.2f ",light);
             fprintf(fp, "P %6.2f ", P);
             fprintf(fp, "t %6.2f ", t);
-             accelerometer.getOutput(readings);
-            fprintf(fp,"%+4.2f, %+4.2f, %+4.2f",
-             (float((int16_t)readings[0]+18)/256), 
-             (float((int16_t)readings[1]-4 )/256), 
-             (float((int16_t)readings[2]+22)/256));
-
             fprintf(fp,"\n\r");
-   //         fclose(fp);
+        //  fclose(fp);
         }//if
 
         if (count % 10 == 0) { 
             xbee.printf("S %f ", seconds);
             xbee.printf("T %5.2f ",r_temp);
-            xbee.printf("H %5.2f ",((vo*8-6)/25));
+            xbee.printf("H %5.2f ",((vo*8-6)/25+0.11));
 //            xbee.printf("X %5.2f ",(ax*33-1.65)/0.66);
 //            xbee.printf("Y %5.2f ",(ay*33-1.65)/0.66);
 //            xbee.printf("Z %5.2f ",(az*33-1.65)/0.66);
               accelerometer.getOutput(readings);
-             xbee.printf("X %+4.2f, Y %+4.2f, Z %+4.2f",
+             pc.printf("X %+4.2f, Y %+4.2f, Z  %+4.2f ",
              (float((int16_t)readings[0]+18)/256), 
              (float((int16_t)readings[1]-4 )/256), 
              (float((int16_t)readings[2]+22)/256));
-            xbee.printf("L %5.2f",light);
+             xbee.printf("X %+4.2f Y %+4.2f Z  %+4.2f ",
+             (float((int16_t)readings[0]+18)/256-0.12), 
+             (float((int16_t)readings[1]-4 )/256-0.13), 
+             (float((int16_t)readings[2]+22)/256+0.02));
+            xbee.printf("L %5.2f ",light);
             xbee.printf("P %6.2f ", P);
             xbee.printf("t %6.2f ", t);
             xbee.printf("\n\r");
@@ -122,5 +125,5 @@
         ++count;
         wait(0.1);
     }//while
-   fclose(fp);
+    
 }