Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of 2015robot_main by
Diff: Swing.h
- Revision:
- 112:717acc7c99f9
- Parent:
- 101:b67d33e56b66
diff -r 846ea36dc1dc -r 717acc7c99f9 Swing.h
--- 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);

