2015_robocon_bteam / Mbed 2 deprecated 2015robot_main

Dependencies:   PID QEI mbed

Fork of 2015robot_main by Naoto Deguchi

Revision:
112:717acc7c99f9
Parent:
101:b67d33e56b66
--- a/Swing.h	Tue Oct 20 09:05:43 2015 +0000
+++ b/Swing.h	Wed Oct 21 08:15:06 2015 +0000
@@ -5,8 +5,14 @@
 PID contSwing(20.917 ,2.0 ,0.0 ,RATE);
 Ticker interruptSwingSpeed;
 
+int resetSwingSpeed = 0;
+
 inline void countSwingSpeed() {
     static int i = 0;
+    if (resetSwingSpeed == 1) {
+        i = 0;
+        resetSwingSpeed = 0;
+    }
     if (i <= swingspeed) {
         i+=swingspeed/10.0;
         targSwingRadVelocity=i;
@@ -16,6 +22,7 @@
     }
 }
 
+
 inline void initializeSwing() {
     interrupter.rise(&countSwing);
     Motor_swing.period_us(SWING_PERIOD);