2020/08/31 bmx055のライブラリ及びプログラム内容を一部変更. 変換レートを更新する必要あり?
Dependencies: mbed BMX055_rev2 SDFileSystem GPS_Interface
Revision 13:7947a88c4e39, committed 2020-09-09
- Comitter:
- MatsumotoKouki
- Date:
- Wed Sep 09 06:45:29 2020 +0000
- Parent:
- 11:2fc33706edd4
- Commit message:
- not stop while nichrome (if ver)
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2fc33706edd4 -r 7947a88c4e39 main.cpp --- a/main.cpp Mon Aug 31 11:21:27 2020 +0000 +++ b/main.cpp Wed Sep 09 06:45:29 2020 +0000 @@ -16,6 +16,8 @@ Ticker warikomi; Timeout t; +Timer t1; + //double a[3],b[3],c[3]; int i,j=0,rlock,mode; char ns,ew; @@ -31,6 +33,7 @@ //void callback (); void FlightPinDriver(); void nichrome_ON(); +//void nichrome_OFF(); void buzzer(); @@ -47,11 +50,34 @@ //pc.baud(9600); //gps.attach(getGPS(&hokui_n,&tokei_n),Serial::RxIrq); fprintf(fp,"N,E,acc:x,acc:y,acc:z,gyr:x,gyr:y,gyr:z,mag:x,mag:y,mag:z\r\n"); - warikomi.attach(&FlightPinDriver,0.5); + //warikomi.attach(&FlightPinDriver,0.5); while(1) { //BMX055部分 + + if(FlightPin==1){ + printf("Flight Pin Worked!!\n\r"); + t1.start(); + // warikomi.detach(); + } + + if(t1==3){ //ニクロム線作動までの時間 + printf("cut!\n\r"); + fet1=1; + } + + if(t1==6){ //カット終了までの時間 + printf("cut finished"); + fet1=0; + } + + if(t1==9){ //ブザー作動までの時間 + printf("buzzer"); + fet2=1; + } + + bmx.getAcc();//加速度の取得 bmx.getGyro();//角力加速度の取得 bmx.getMag();//地磁気の取得 @@ -66,10 +92,10 @@ //gps.getgps(); int x = (gps.longtitude-135.0f)*1000000; int y = (gps.latitude-34.0f)*1000000; - if(x==NULL)x=0; - if(y==NULL)y=0; - int north=x * 1000000; - int east=y * 1000000; + if(gps.longtitude==NULL)x=0; + if(gps.latitude==NULL)y=0; + //int north=x * 1000000; + //int east=y * 1000000; //SDカードへの書き込み fprintf(fp,"%f,%f,%f,%f,%f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f\n\r",gps.longtitude,gps.latitude,(a[0]/512)*9.8, @@ -87,7 +113,7 @@ uart.printf("%04hX%04hX%04hX",a[0],a[1],a[2]);//加速度の書き出し uart.printf("%04hX%04hX%04hX",b[0],b[1],b[2]);//角加速度の書き出し - uart.printf("%08x%08x",east,north);//GPS書き出し + uart.printf("%08x%08x",x,y);//GPS書き出し uart.printf("\r\n"); //printf("%d%d\n\r",north,east); @@ -96,11 +122,11 @@ } } -void FlightPinDriver(){ +/*void FlightPinDriver(){ if(FlightPin==1){ printf("Flight Pin Worked!!\n\r"); - warikomi.detach(); + //warikomi.detach(); t.attach(nichrome_ON,3);//ニクロムを作動させるまでの時間 } @@ -109,13 +135,11 @@ void nichrome_ON(){ printf("cut!\n\r"); fet1=1; - wait(2.0);//テグスを切るまでにかかる時間 - fet1=0; t.detach(); - t.attach(buzzer,6);//ブザー作動までの時間 + t.attach(nichrome_OFF,6);//ブザー作動までの時間 } void buzzer(){ printf("buzzer\n\r"); fet2=1; - } \ No newline at end of file + }*/ \ No newline at end of file