program to shoot beenbags

Dependencies:   mbed MOTOR

arrcmbedをインクルードしてください。

Revision:
11:62c85df03747
Parent:
10:5e3c789e07dc
Child:
12:aef2a6626ea5
--- a/main.cpp	Wed Jan 19 09:05:16 2022 +0000
+++ b/main.cpp	Wed Jan 19 14:34:32 2022 +0000
@@ -70,11 +70,9 @@
             case 1://装填動作
             while(limit_1.read() == 0){
                 motor_shoot.output(load_pwm);
-                printf("loading\n"); 
-                if(limit_1.read() == 1){
-                    break;
-                }
-            }
+                printf("loading\n");
+                wait(0.1);
+            } 
             motor_shoot.output(0.0);
             wait(1);
             //shoot_phase = 2;
@@ -94,7 +92,8 @@
             case 3://モーター復帰
             while(limit_2.read() == 0){
                 motor_shoot.output(back_pwm);
-                printf("backing\n"); 
+                printf("backing\n");
+                wait(0.1); 
             }
             motor_shoot.output(0.0);
             shoot_phase = 4;
@@ -103,15 +102,15 @@
             
             case 4://発射動作
             servo.pulsewidth_us(theta_90);
-            printf("finished shooting %dst shot\n",count);  
+            printf("finished shooting %d shot\n",count);  
             count ++;
             wait(1);
             servo.pulsewidth_us(theta_0);
             shoot_phase = 0;
-            printf("finished initialize\n");  
+            printf("finished init\n");  
             break;
             
-        } 
+        }
     }
 }