narumi tatsuya
/
motor_sample
ルンパッパ
Diff: main.cpp
- Revision:
- 5:e922c07f1b61
- Parent:
- 4:443e82b039ba
- Child:
- 6:51fbb88bdb6a
diff -r 443e82b039ba -r e922c07f1b61 main.cpp --- a/main.cpp Sat Dec 19 09:24:42 2020 +0000 +++ b/main.cpp Sat Dec 19 11:01:55 2020 +0000 @@ -9,6 +9,7 @@ #define PIN_SCL D5 Serial pc(SERIAL_TX,SERIAL_RX,921600);//通信 +BMP180 bmp180(PIN_SDA,PIN_SCL);//気圧センサーのピン Serial xbee(D1,D0);//Xbeeのピン DigitalOut FET1(D9);//FETのピン DigitalOut FET2(D8); @@ -20,13 +21,13 @@ int main(){ float avalt,x8; + float pressure,temperature,altitude;//気圧,気温,高度 FET1=0; FET2=0; SW=1; flight==1;//フライトピンがついている - - - while(1) { + +while(1) { if(flight==1) { wait(1); }//フライトピンがついているとき1秒待機 @@ -46,9 +47,8 @@ } } } - BMP180 bmp180(PIN_SDA,PIN_SCL); - float pressure,temperature,altitude;//気圧,気温,高度 - int n; + + int n=0; int t=0; xbee.printf("\rstart!\n\r");//気圧センサースタート bmp180.Initialize(27,BMP180_OSS_ULTRA_HIGH_RESOLUTION);//27は府大の海抜高度 @@ -122,11 +122,11 @@ } } /*speedが3回0.5m/s以下になったらFETに20秒電流を流してその後電流を止める*/ - FET1=1; -wait(10); -FET1=0; -motor = 100; -double a; + FET1=1; + wait(10); + FET1=0; + motor = 100; + double a; double b; double distance;