shoot

Dependencies:   mbed SBDBT arrc_mbed Servo air

Revision:
1:cae30876c429
Parent:
0:6f9a457b09e1
Child:
2:0428390d7c90
--- a/main.cpp	Wed Jan 19 08:37:40 2022 +0000
+++ b/main.cpp	Mon Jan 24 08:11:10 2022 +0000
@@ -28,10 +28,13 @@
     }
 //↓発射用
 void Hassya(bool data,int tim){
-    if((data==1 || timer.read_ms()-tim<3000) && limitA){
-        hassya.move(0);
+    if(data==1 || timer.read_ms()-tim<3000){
+        if(timer.read_ms()-tim>2000){
+            hassya.move(1);
+        }else{
+            hassya.move(0);
+        }
         if(timer.read_ms()-tim>1000) Servo(1);
-        if(timer.read_ms()-tim>2000) hassya.move(1);
     }else{
         if(limitA){
             driveMotorS(0);
@@ -48,7 +51,8 @@
     timer.start();
     while(true){
         //コントローラ関係
-        if(old_square<ds3.square()){
+        if(old_square<ds3.square() && (!shoot || limitA)){
+            
             shoot=!shoot;
             tim=timer.read_ms();
         }