for baska

Dependencies:   Hepta9axis HeptaBattery HeptaCamera_GPS HeptaTemp SDFileSystem mbed

Fork of Lab4-11_model_program_3 by HEPTA-Sat Training 2017~2018

Revision:
19:373bc6926349
Parent:
17:2b3b88724c68
--- a/main.cpp	Tue Aug 14 10:46:55 2018 +0000
+++ b/main.cpp	Wed Aug 22 02:15:07 2018 +0000
@@ -10,7 +10,7 @@
 HeptaBattery battery(p16,p26);
 HeptaCamera_GPS cam_gps(p13, p14,p25,p24);
 Hepta9axis n_axis(p28,p27,0xD0,0x18);
-HeptaTemp temp(p17);
+HeptaTemp temper(p17);
 
 DigitalOut myleds[] = {LED1,LED2,LED3,LED4};;
 
@@ -38,7 +38,7 @@
 {
     pc.baud(9600);
     float bt;
-    float temper;
+    float temp;
     char str[100];
     float ax,ay,az;
     float gx,gy,gz;
@@ -49,14 +49,14 @@
     int flag = 0;
     while(1) {
         battery.power_saving_mode(&flag,&bt);
-        temp.temp_sense(&temper);
+        temper.temp_sense(&temp);
         wait(0.5);
-        pc.printf("flag = %d, bt = %.2f [V], temp = %.1f [C]\r\n",flag,bt,temper);
+        pc.printf("flag = %d, bt = %.2f [V]\r\n",flag,bt);
         if(flag == 1) {
             pc.printf("Low Battery\r\n");
-        } else if(temper > 35.0) {
+        } else if(temp > 35.0) {
             pc.printf("High Temperaturer\n");
-        } else if((flag == 1) & (temper > 35.0)) {
+        } else if((flag == 1) & (temp > 35.0)) {
             pc.printf("Low Battery and High Temperaturer\n");
         }
         receive(&rcmd,&cmdflag);
@@ -94,18 +94,33 @@
                 }
             }//
             if (rcmd == 'c') {
-                
+                //pc.printf("Command Get = %d", 'rcmd');
+                //get temperture
+                temper.temp_sense(&temp);
+                //get 9-axis
+                n_axis.sen_acc(&ax,&ay,&az);
+                n_axis.sen_gyro(&gx,&gy,&gz);
+                n_axis.sen_mag(&mx,&my,&mz);    
+                //get GPS Data
+                cam_gps.gga_sensing(&time, &latitude, &ns, &longitude, &ew, &quality, &stnum, &hacu, &altitude, &aunit, &gps_check);
                 
-                
-                
+                //Display_All Data
+                pc.printf("temp = %.2f[C]\r\n",temp);
+                pc.printf("%f,%f,%f\r\n",ax,ay,az);
+                pc.printf("%f,%f,%f\r\n",gx,gy,gz);
+                pc.printf("%f,%f,%f\r\n",mx,my,mz);
+                pc.printf("GPGGA,%f,%f,%c,%f,%c,%d,%d,%f,%f,%c\r\n",time,latitude,ns,longitude,ew,quality,stnum,hacu,altitude,aunit);
+                wait(0.3);
             }
             if (rcmd == 'd') {
-                
-                
-                
-                
+                pc.printf("Camera Snapshot Mode\r\n");
+                pc.printf("Hit Any Key To Take Picture\r\n");
+                while(!pc.readable()) {}
+                cam_gps.Sync();
+                cam_gps.initialize(HeptaCamera_GPS::Baud115200, HeptaCamera_GPS::JpegResolution320x240);
+                cam_gps.test_jpeg_snapshot_picture("/sd/test.jpg");             
             }
             initialize();
         }
     }
-}
\ No newline at end of file
+}