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.
Dependencies: HIDScope MODSERIAL QEI biquadFilter mbed
Fork of frdm_Motor_V2_2 by
Diff: main.cpp
- Revision:
- 8:69bde5e32dbf
- Parent:
- 7:67b50d4fb03c
- Child:
- 9:774fc3c6a39e
--- a/main.cpp Tue Sep 29 12:19:51 2015 +0000
+++ b/main.cpp Tue Sep 29 12:45:26 2015 +0000
@@ -18,7 +18,7 @@
double Aantal_pulses;
double Error;
double refference;
-const double Kp = 0.005;
+const double Kp = 0.007;
void ScopeSend()//Functie die de gegevens voor de scope uitleest en doorstuurt
@@ -66,12 +66,27 @@
{
motor2direction = 1;
}
-
}
}
-
-
-
-
+ if(c == 'f')
+ {
+ refference = refference - 10;
+ pc.printf("rx \n");
+ Error = refference - Aantal_Degs;
+ while(abs(Error) > 1)
+ {
+ Error = refference - Aantal_Degs;
+ motor2speed = Kp*abs(Error);
+ pc.printf("reffence = %f,error = %f,Aantal degs = %f \n",refference,Error,Aantal_Degs);
+ if(Error > 0)
+ {
+ motor2direction = 0;
+ }
+ else
+ {
+ motor2direction = 1;
+ }
+ }
+ }
}
}
\ No newline at end of file
