program to shoot beenbags

Dependencies:   mbed MOTOR

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

Revision:
14:81f09ab5ed23
Parent:
13:66e37e0aa786
Child:
15:7c26b01dcefd
diff -r 66e37e0aa786 -r 81f09ab5ed23 main.cpp
--- a/main.cpp	Thu Jan 20 15:31:50 2022 +0000
+++ b/main.cpp	Sat Jan 22 15:05:22 2022 +0000
@@ -39,15 +39,17 @@
 
 void revolver_back(int count){
     if(turn_able == 1){
-        while(roricon < 341 * count || limit_2.read() == 0){
-            if(roricon < 341 * count){
-                roricon = v.get();
-                motor_revolver.output(revolver_pwm);
-                printf("roricon = %d\n",roricon);    
-            }else{
-                motor_revolver.output(0);
-                turn_able = 0;
-                printf("finished turnning\n");  
+        while(roricon < 341 * (count - 1) || limit_2.read() == 0){
+            if(count != 1){
+                if(roricon < 341 * (count - 1)){
+                    roricon = v.get();
+                    motor_revolver.output(revolver_pwm);
+                    printf("roricon = %d\n",roricon);    
+                }else{
+                    motor_revolver.output(0);
+                    turn_able = 0;
+                    printf("finished turnning\n");  
+                }    
             }
             
             if(limit_2.read() == 0){