skipper_raspi_uart_test
Dependencies: mbed MPU6050_2 HMC5883L_4 SDFileSystem3
Diff: main.cpp
- Revision:
- 40:917b50b9e863
- Parent:
- 39:3faddfc87351
- Child:
- 41:d142afd3c2f7
--- a/main.cpp Mon Mar 04 17:28:47 2019 +0000 +++ b/main.cpp Tue Mar 05 16:46:01 2019 +0000 @@ -74,7 +74,7 @@ bool setupFlag = false; bool CameraDegFlag = false; -bool jevoisFlag = false; +bool jevoisFlag = true; bool FocusFlag = false; int g_CameraDegCounter = 0; //カメラの回転数をカウント @@ -144,7 +144,7 @@ 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); @@ -164,7 +164,7 @@ g_fp = fopen( "/sd/Datalog01.txt","a" ); fprintf(g_fp, "Time = %d min %d sec : Start sarching target .\r\n",(int)t2.read()/60,(int)t2.read()%60); fclose(g_fp); - + */ servoTurnTable.pulsewidth_us(Turntable_NEUTRAL + Turntable_speed); pc.printf("MatchPosition\r\n"); @@ -474,6 +474,28 @@ pc.printf("g_CameraDegCounter = %d\r\n",g_CameraDegCounter); + + //ターゲットを発見できなかった場合 + if(g_CameraDegCounter-2 > (float)Time360/(float)Camera_board_wait){ + + servoTurnTable.pulsewidth_us(Turntable_NEUTRAL + Turntable_speed); + wait(1); + while(BoardCheck == 0){ + } + servoTurnTable.pulsewidth_us(Turntable_NEUTRAL); + + if(jevoisFlag == true ) { + servoTurnTable.pulsewidth_us(Turntable_NEUTRAL + Turntable_speed); + wait_ms((float)Time360/(float)2); + servoTurnTable.pulsewidth_us(Turntable_NEUTRAL); + } + if(jevoisFlag == false) MoveCansat('4'); + + jevoisFlag = !jevoisFlag; + + g_CameraDegCounter = 0; + } + //pc.printf("Move Board Finish\r\n"); return; }