skipper_raspi_uart_test

Dependencies:   mbed MPU6050_2 HMC5883L_4 SDFileSystem3

Revision:
29:5d239812ace6
Parent:
28:887df143fa9c
Child:
30:90252dc48c1a
--- a/main.cpp	Wed Feb 20 03:24:30 2019 +0000
+++ b/main.cpp	Tue Feb 26 10:52:35 2019 +0000
@@ -72,7 +72,7 @@
 
 bool setupFlag = false;
 bool CameraDegFlag = false;
-bool jevoisFlag = true;
+bool jevoisFlag = false;
 
 int g_CameraDegCounter = 0;    //カメラの回転数をカウント
 
@@ -135,15 +135,23 @@
         pc.printf("\r\n");
         wait_ms(30);
     }*/
-        
     
-    servoCameradeg.pulsewidth_us(Camera_deg_A);
     
     // シリアル通信受信の割り込みイベント登録
     pc.attach(getSF_Serial_jevois, Serial::RxIrq);
     pc2.attach(getSF_Serial_pi, Serial::RxIrq);
     t2.start();
     
+    NVIC_DisableIRQ(USART2_IRQn);
+    while(g_landingcommand != 'B'){
+        wait_ms(30);
+        }
+        
+    jevoisFlag = true; 
+    NVIC_EnableIRQ(USART2_IRQn);
+    wait(5); 
+    pc.printf("start\r\n");  
+    
     while(1) {
         if(jevoisFlag==true) NVIC_DisableIRQ(USART1_IRQn);
         else NVIC_DisableIRQ(USART2_IRQn);
@@ -361,6 +369,8 @@
     MoveCansat('N');
     //pc.printf("ok\r\n");
     g_landingcommand='N';
+    servoCameradeg.pulsewidth_us(Camera_deg_B);
+    wait_ms(30);
     servoTurnTable.pulsewidth_us(Turntable_NEUTRAL - Turntable_speed);
     wait_ms(Camera_board_wait);
     g_CameraDegCounter++;
@@ -369,25 +379,17 @@
     if(jevoisFlag == true) FocusAdjust();
     else wait(1);
     if(g_landingcommand!='N') return;
-    if(!CameraDegFlag){
-        for(int i=30; i<Camera_deg_B-Camera_deg_A;i=i+30){
-            servoCameradeg.pulsewidth_us(Camera_deg_A+i);
-            //pc.printf("%d\r\n",i);
-            wait_ms(20);
-            }
-        CameraDegFlag=!CameraDegFlag;
-        }else{
-            for(int i=30; i<Camera_deg_B-Camera_deg_A;i=i+30){
-            servoCameradeg.pulsewidth_us(Camera_deg_B-i);
-            //pc.printf("%d\r\n",i);
-            wait_ms(20);
-            }
-        CameraDegFlag = !CameraDegFlag;
+    
+    for(int i=200; i<Camera_deg_B-Camera_deg_A;i=i+200){
+            
+             servoCameradeg.pulsewidth_us(Camera_deg_B-i);
+             wait_ms(30); 
+            //pc.printf("zoom2\r\n");  
+            if(jevoisFlag == true) FocusAdjust();
+            else wait(1);
+            if(g_landingcommand!='N') return;  
+    
     }
-    if(g_landingcommand!='N') return;  
-    //pc.printf("zoom2\r\n");  
-    if(jevoisFlag == true) FocusAdjust();
-    else wait(1);
     
     
     //pc.printf("Move Board Finish\r\n");  
@@ -572,7 +574,7 @@
     servoR.pulsewidth_us(Servo_NEUTRAL_R);       //servo initialize
     servoL.pulsewidth_us(Servo_NEUTRAL_L);
     servoTurnTable.pulsewidth_us(Turntable_NEUTRAL);
-    servoCameradeg.pulsewidth_us(Camera_deg_A);
+    servoCameradeg.pulsewidth_us(Camera_deg_B);
     servoCameraPinto.pulsewidth_us(focus_NEUTRAL);
      
     SetOptions(&Servo_NEUTRAL_R, &Servo_NEUTRAL_L,