cansat_B 2019 / Mbed 2 deprecated CanSatB2019_main_1214_essence_8_6

Dependencies:   mbed

Revision:
9:435ce4946f6c
Parent:
8:765a73e21907
Child:
10:6e02396abaf5
diff -r 765a73e21907 -r 435ce4946f6c main.cpp
--- a/main.cpp	Fri Dec 06 08:35:28 2019 +0000
+++ b/main.cpp	Fri Dec 06 09:09:42 2019 +0000
@@ -181,13 +181,18 @@
 
             for (int r = 0; r < 1; r++) {
                if (camera.isReady()) {
-                 char filename[32];
-                 sprintf(filename, "/local/pict%03d.jpg",r);
+                 
+                 char filename[25];
+                 snprintf(filename,25,"%s%03d%s", "/local/pict",r,".jpg");
                  printf("Picture: %s ", filename);
                  if (camera.takePicture(filename)) { 
                   while (camera.isProcessing()) {
                     camera.processPicture();
-                    printf("take pictuer!");
+                    printf("take picture!");
+                    
+                    xbee.printf("xbee connnected!\r\n");
+                    bs = new base64();
+                    bs->Encode(filename,"/local/data.txt");
                    }
                  }else{
                  printf("take picture failed\r\n");
@@ -197,14 +202,9 @@
                 }
                
                printf("time = %f\n", timer.read());
-               
-       
+            
                
-               xbee.printf("xbee connected!\r\n");
-               bs = new base64();
-               bs->Encode("/local/pict000.jpg","/local/data000.txt");
-               
-               if((fp=fopen("/local/data000.txt","r"))!=NULL)
+               if((fp=fopen("/local/data.txt","r"))!=NULL)
                {
                    pc.printf("ok\r\n");
                    while((c=fgetc(fp))!=EOF){