![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
change2shinsu
Dependencies: mbed mbedTimer SDFileSystem MU2 GPS
Revision 21:fa4360ec5014, committed 2019-09-09
- Comitter:
- takepiyo
- Date:
- Mon Sep 09 06:35:47 2019 +0000
- Parent:
- 20:b70e877cdc0f
- Commit message:
- 2shinsuuled
Changed in this revision
inletclose/inletclose.h | 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 b70e877cdc0f -r fa4360ec5014 inletclose/inletclose.h --- a/inletclose/inletclose.h Mon Sep 09 05:41:18 2019 +0000 +++ b/inletclose/inletclose.h Mon Sep 09 06:35:47 2019 +0000 @@ -22,13 +22,9 @@ :_Out(Out),_In1(In1),_In2(In2) {} - void Close(float judge)//センサのどっちかがjudgeを超えるとモーターは停止 + void Close() { _Out=1; - - if(getvalue1()>judge | getvalue2()>judge) { - _Out=0; - } } void Stop()
diff -r b70e877cdc0f -r fa4360ec5014 main.cpp --- a/main.cpp Mon Sep 09 05:41:18 2019 +0000 +++ b/main.cpp Mon Sep 09 06:35:47 2019 +0000 @@ -3,7 +3,6 @@ This is a test program! *******************************************************************************/ - #include "mbed.h" #include "MU2.h" #include "GPS.h" @@ -25,10 +24,11 @@ char fname[]="/sd/CanSat/log0907GPStest1.csv";//ファイル名をここで設定 char fname2[]="/sd/CanSat/sensor0907GPStest1.csv";//感圧センサーのログファイル -////////////////フライトピンが抜ける→シェンロン展開→インレット閉鎖→待機 -//シーケンス番号//1//////////////////2///////////3///////////4/// +////////////////溶断→シェンロン展開→インレット連続閉鎖→インレットインターバル閉鎖→待機モード +//シーケンス番号//0001////////0010////////////0011///////////0100/////////0101/// //mbedのLEDが各シーケンス番号を2進数で示す:ex 0011 インレット閉鎖中 //ただし今回はシーケンス4つなのでそれぞれのシーケンスでそれぞれのLEDが光る +//しかしながらシーケンスが増えたので2進数を採用する MU2 MuPort(p28,p27); SDFileSystem sd(p5, p6, p7, p8, "sd");//3号機11,12,13,14 4号機5,6,7,8 @@ -67,6 +67,19 @@ timer_rec.start(); wait(5);//起動してからちょっと待つ + + myled=1; + myled2=0; + myled3=1; + myled4=0; + + wait(1); + + myled=0; + myled2=1; + myled3=0; + myled4=1; + inlet.Stop(); FILE* fp= fopen(fname, "a"); if(fp == NULL) { @@ -83,8 +96,13 @@ myled3=0; myled4=0; } + } - } + wait(1); + myled=0; + myled2=0; + myled3=0; + myled4=0; val=timer_rec.read(); myTimer.sendMessage(val); @@ -109,10 +127,12 @@ while(1) { myled=0; myled2=0; + myled3=0; + myled4=1; mygps.getGPGGA(); if(mygps.GPSread) { - myled=1; + myled4=0; val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); @@ -171,11 +191,13 @@ while(1) { myled=0; - myled2=1; + myled2=0; + myled3=1; + myled4=0; mygps.getGPGGA(); if(mygps.GPSread) { - myled=1; + myled3=0; val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); @@ -219,10 +241,14 @@ timer2=0; count=0; - while(1) { + while(1) + { myled=0; myled2=0; myled3=1; + myled4=1; + + inlet.Close(); mygps.getGPGGA(); @@ -238,7 +264,8 @@ timer2++; if(mygps.GPSread) { - myled2=1; + myled3=0; + myled4=0; val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); @@ -255,7 +282,8 @@ count++; } - if(count>=SAMPLENUMBER) { + if(count>=SAMPLENUMBER) + { val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); @@ -265,7 +293,13 @@ timer=0;//モーター時間で止める用 - while(1) { + while(1) //剛性を得た後一定時間でとめる + { + myled=0; + myled2=1; + myled3=0; + myled4=0; + mygps.getGPGGA(); val=timer_rec.read(); @@ -279,8 +313,9 @@ //fclose(fp2); timer2++; - if(mygps.GPSread) { - myled2=1; + if(mygps.GPSread) + { + myled2=0; val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); @@ -293,17 +328,17 @@ } - if(timer>=CLOSETIME) { + if(timer>=CLOSETIME) + { break; } - } inlet.Stop(); val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); - fprintf(fp, "%s TimeOverClosingModeFinish!\r\n",myTimer.timeMessage); + fprintf(fp, "%s ClosingModeFinish!\r\n",myTimer.timeMessage); //MuPort.send(myTimer.timeMessage); //MuPort.send("Time over. Closing Mode Finish!\r\n"); fclose(fp); @@ -322,12 +357,14 @@ } - if(timer>LIMITTIME) { + if(timer>LIMITTIME) + { + inlet.Stop(); val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); - fprintf(fp, "%s ClosingModeFinsh!\r\n",myTimer.timeMessage); + fprintf(fp, "%s TimeOver!ClosingModeFinsh!\r\n",myTimer.timeMessage); //MuPort.send(myTimer.timeMessage); //MuPort.send("Closing Mode Finish!\r\n"); fclose(fp); @@ -335,9 +372,6 @@ break; } - - inlet.Close(1.1);//1より大きい引数にしておけばモーターはずっと回ってる. - } /******************************************************************************* @@ -361,7 +395,7 @@ while(1) { myled=0; - myled2=0; + myled2=1; myled3=0; myled4=1; @@ -379,7 +413,8 @@ timer2++; if(mygps.GPSread) { - myled3=1; + myled2=0; + myled4=0; val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); @@ -406,7 +441,7 @@ while(1) { myled=0; - myled2=0; + myled2=1; myled3=0; myled4=1; mygps.getGPGGA(); @@ -423,7 +458,8 @@ timer2++; if(mygps.GPSread) { - myled2=1; + myled2=0; + myled4=0; val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3); @@ -472,7 +508,7 @@ break; } - inlet.Close(1.1);//1より大きい引数にしておけばモーターはずっと回ってる. + inlet.Close(); } @@ -493,13 +529,15 @@ while(1) { myled=0; - myled2=0; - myled3=0; + myled2=1; + myled3=1; myled4=0; mygps.getGPGGA(); - if(mygps.GPSread) { - myled4=1; + if(mygps.GPSread) + { + myled2=0; + myled3=0; val=timer_rec.read(); val3=val+val2; myTimer.sendMessage(val3);