Hepta

Dependencies:   Hepta2_9axis HeptaBattery HeptaTemp HeptaXbee SDHCFileSystem mbed

Fork of HEPTA2_ALL_ver0803_02 by Hepta 2

Files at this revision

API Documentation at this revision

Comitter:
umeume
Date:
Sat Aug 05 14:22:08 2017 +0000
Parent:
5:aedf4491aa0f
Commit message:
Hepta

Changed in this revision

HeptaSerial.lib Show annotated file Show diff for this revision Revisions of this file
HeptaXbee.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r aedf4491aa0f -r a61510510f54 HeptaSerial.lib
--- a/HeptaSerial.lib	Sat Aug 05 13:37:01 2017 +0000
+++ b/HeptaSerial.lib	Sat Aug 05 14:22:08 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/hepta2ume/code/Hepta_Serial/#c11f48bbb567
+https://developer.mbed.org/users/umeume/code/HeptaSerial/#a41100627f55
diff -r aedf4491aa0f -r a61510510f54 HeptaXbee.lib
--- a/HeptaXbee.lib	Sat Aug 05 13:37:01 2017 +0000
+++ b/HeptaXbee.lib	Sat Aug 05 14:22:08 2017 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/hepta2ume/code/HeptaXbee/#031c35ada7e6
+https://developer.mbed.org/users/umeume/code/HeptaXbee/#c3e667ee70f1
diff -r aedf4491aa0f -r a61510510f54 main.cpp
--- a/main.cpp	Sat Aug 05 13:37:01 2017 +0000
+++ b/main.cpp	Sat Aug 05 14:22:08 2017 +0000
@@ -5,30 +5,25 @@
 #include "Hepta9axis.h"
 #include "HeptaTemp.h"
 #include "HeptaBattery.h"
-#define USE_JPEG_HIGH_RESOLUTION  1
 
 Serial pc(USBTX,USBRX);
 SDFileSystem sd(p5, p6, p7, p8, "fs");
 HeptaXbee xbee(p9,p10);
-HeptaSerial camera(p13, p14);
+HeptaSerial camera(p13, p14,p25,p26);
 HeptaMPU9250 MPU9250(p28,p27,0xD0,0x18);//sda,scl,acc&gyro_address,mag_gyro
 HeptaTemp heptatemp(p17);
 HeptaBattery bat(p16,p26);
+/*
 DigitalOut CAM_SW(p25);//CAM_control
 DigitalOut GPS_SW(p24);//GPS_control
-
+*/
 int main()
 {
-    char mode;
+     char mode;
     //pc.baud(9600);
 
     while(1) {
 
-        /*
-        ************
-        Mode select
-        ***********
-        */
         pc.printf("\r\n");
         pc.printf("*********************************\r\n");
         pc.printf("Hello world.\r\n");
@@ -51,14 +46,13 @@
         pc.printf("o:All Transmitting Mode\r\n");
         pc.printf("*********************************\r\n");
 
-        mode = xbee.getc();
+        mode = pc.getc();
         pc.printf("\r\n");
         pc.printf("Your select Mode = %c\r\n",mode);
         wait(0.5);
 
         switch(mode) {
             case'a': {
-
                 printf("=============\r\n");
                 printf("SD test Mode\r\n");
                 printf("=============\r\n");
@@ -73,27 +67,19 @@
 
 
                 break;
-            }//case'1'
+            }//case'a'
 
-            /*
-            ************************
-            Check Battery Level mode
-            ************************
-            */
             case'b': {
+                printf("===================\r\n");
+                printf("Check Battery Level\r\n");
+                printf("===================\r\n");
                 float bt;
-                for(int i = 0;i<50;i++){
-                bat.vol(&bt);
-                pc.printf("V = %f\r\n",bt);
+                for(int i = 0; i<50; i++) {
+                    bat.vol(&bt);
+                    pc.printf("V = %f\r\n",bt);
                 }
                 break;
-            }
-
-            /*
-            ******************
-            Gyro sensing mode
-            ******************
-            */
+            }//case'b'
 
             case'c': {
                 printf("===================\r\n");
@@ -106,13 +92,7 @@
                     wait(0.5);
                 }
                 break;
-            }//case'2'
-
-            /*
-            ******************
-            Accel sensing mode
-            ******************
-            */
+            }//case'c'
 
             case'd': {
                 printf("===================\r\n");
@@ -125,13 +105,7 @@
                     wait(0.5);
                 }
                 break;
-            }//case'3'
-
-            /*
-            ******************
-            Magnet sensing mode
-            ******************
-            */
+            }//case'd'
 
             case'e': {
                 float mx,my,mz;
@@ -144,29 +118,25 @@
                     wait(0.5);
                 }
                 break;
-            }//case'4'
-
-            /*
-            ******************
-            GPS sensing mode
-            ******************
-            */
+            }//case'e'
 
             case'f': {
-                GPS_SW = 1;
-                CAM_SW = 0;
+                //GPS_SW = 1;
+                //CAM_SW = 0;
                 printf("===================\r\n");
                 printf("GPS sensing Mode\r\n");
                 printf("===================\r\n");
                 while(1) pc.putc(camera.getc());
                 break;
-            }//case'4'
+            }//case'f'
 
 
             case'g': {
-                GPS_SW = 1;
-                CAM_SW = 0;
+                //GPS_SW = 1;
+                //CAM_SW = 0;
+                printf("===================\r\n");
                 pc.printf("GPS GPGGA Mode\r\n");
+                printf("===================\r\n");
                 int quality=0,stnum=0,gps_check=0;
                 char ns='A',ew='B',aunit='m';
                 float time=0.0,latitude=0.0,longitude=0.0,hacu=0.0,altitude=0.0;
@@ -177,77 +147,55 @@
                     }
                 }
                 break;
-            }
+            }//case'g'
 
-            /*
-            ******************
-            Camera Synchro  mode
-            ******************
-            */
 
             case'h': {
-                GPS_SW = 0;
-                CAM_SW = 1;
+                //GPS_SW = 0;
+                //CAM_SW = 1;
                 wait(0.5);
                 printf("\r\n");
                 printf("==========\r\n");
-                printf("CameraC1098\r\n");
+                printf("Camera Synchro\r\n");
                 printf("==========\r\n");
                 camera.Sync();
                 break;
-            }//case'6'
-
-            /*
-            ******************
-            Cam Snapshot mode
-            ******************
-            */
+            }//case'h'
 
             case'i': {
-                GPS_SW = 0;
-                CAM_SW = 1;
+                //GPS_SW = 0;
+                //CAM_SW = 1;
                 printf("\r\n");
                 printf("==========\r\n");
                 printf("CameraC1098\r\n");
                 printf("==========\r\n");
-                //camera.Sync();
-                //camera.initialize(HeptaSerial::Baud115200, HeptaSerial::JpegResolution320x240);
+                camera.initialize(HeptaSerial::Baud115200, HeptaSerial::JpegResolution320x240);
                 camera.test_jpeg_snapshot_picture(1);
 
                 break;
-            }//case'6'
-
-            /*
-            ******************
-            Cam Snapshot mode
-            ******************
-            */
+            }//case'i'
 
             case'j': {
-                GPS_SW = 0;
-                CAM_SW = 1;
+                //GPS_SW = 0;
+                //CAM_SW = 1;
                 printf("\r\n");
                 printf("==========\r\n");
                 printf("CameraC1098\r\n");
                 printf("==========\r\n");
-                //camera.Sync();
-                //camera.initialize(HeptaSerial::Baud115200, HeptaSerial::JpegResolution320x240);
+                camera.initialize(HeptaSerial::Baud115200, HeptaSerial::JpegResolution320x240);
                 camera.test_jpeg_snapshot_data(1);
 
                 break;
-            }//case'6'
-
-
+            }//case'j'
 
             case'k': {
-                GPS_SW = 0;
-                CAM_SW = 1;
+                //GPS_SW = 0;
+                //CAM_SW = 1;
                 printf("\r\n");
                 printf("==========\r\n");
                 printf("CameraC1098\r\n");
                 printf("==========\r\n");
-                //camera.Sync();
-                //camera.initialize(HeptaSerial::Baud115200, HeptaSerial::JpegResolution320x240);
+                camera.initialize(HeptaSerial::Baud115200, HeptaSerial::JpegResolution320x240);
                 camera.test_jpeg_snapshot_picture(1);
 
                 FILE *fp = fopen("/fs/test.txt", "r");
@@ -256,19 +204,13 @@
                 } else {
                     char str[1024];
                     while((fgets(str,256,fp))!=NULL) {
-                        pc.printf("%s",str);
+                        xbee.printf("%s",str);
                     }
                     fclose(fp);
                 }
 
                 break;
-            }
-
-            /*
-            ******************
-            Temp sensing mode
-            ******************
-            */
+            }//case'k'
 
             case'l': {
                 printf("==================\r\n");
@@ -281,13 +223,7 @@
                     //xbee.printf("%f\r\n",temp);
                 }
                 break;
-            }//case'7'
-
-            /*
-            ***********
-            Xbee mode
-            ***********
-            */
+            }//case'l'
 
             case'm': {
 
@@ -309,20 +245,12 @@
                 }
 
                 break;
-            }//case'8'
-
-            /*
-            ******************
-            Temp sensing mode by Xbbe
-            ******************
-            */
+            }//case'm'
 
             case'n': {
-
                 printf("==================\r\n");
                 printf("Temp sensing Mode & Xbee\r\n");
                 printf("==================\r\n");
-
                 float temp;
                 while(1) {
                     FILE *fp = fopen("/fs/myfile.csv", "a");
@@ -333,18 +261,11 @@
                     fclose(fp);
                 }
                 break;
-            }//case'9'
-
-            /*
-            *********************
-            All Transmitting Mode
-            *********************
-            */
+            }//case'n'
 
             case'o': {
-                GPS_SW = 1;
-                CAM_SW = 0;
-
+                //GPS_SW = 1;
+                //CAM_SW = 0;
                 printf("==================\r\n");
                 printf("All Transmitting Mode\r\n");
                 printf("==================\r\n");