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: MODSERIAL QEI mbed
Fork of EMG_check by
Revision 18:cd292bac4524, committed 2016-10-19
- Comitter:
- sivuu
- Date:
- Wed Oct 19 15:33:19 2016 +0000
- Parent:
- 17:f44f41cab151
- Commit message:
- met eerste poging van de snelheids controlle en regulatie
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 19 15:31:31 2016 +0000
+++ b/main.cpp Wed Oct 19 15:33:19 2016 +0000
@@ -102,6 +102,22 @@
snelheid_motor2 = ((current_position_motor2 - previous_position_motor2)*6.28318530718) / ticker_TS;
pc.printf("snelheid motor 2 is: %f \r\n", snelheid_motor2);
+ if (snelheid_motor1 > 4.9) && (snelheid_motor1 != 0){ // dit moet ook in minder if loops kunnen moet nog ff uitvogelen hoe
+ a=a-0.02;
+ }
+ else if (snelheid_motor1 < 4.9) && (snelheid_motor1 != 0){
+ a=a+0.02;
+ }
+ if (snelheid_motor2 > 4.9) && (snelheid_motor2 != 0){
+ b=b-0.02;
+ }
+ else if (snelheid_motor2 < 4.9) && (snelheid_motor2 != 0){
+ b=b+0.02;
+ }
+ else {
+ a=a;
+ b=b;
+ }
tickerflag = 0;
}
@@ -144,6 +160,23 @@
snelheid_motor2 = ((current_position_motor2 - previous_position_motor2)*6.28318530718) / ticker_TS;
pc.printf("snelheid motor 2 is: %f \r\n", snelheid_motor2);
+ if (snelheid_motor1 > 4.9) && (snelheid_motor1 != 0){ // dit moet ook in minder if loops kunnen moet nog ff uitvogelen hoe
+ a=a-0.02;
+ }
+ else if (snelheid_motor1 < 4.9) && (snelheid_motor1 != 0){
+ a=a+0.02;
+ }
+ if (snelheid_motor2 > 4.9) && (snelheid_motor2 != 0){
+ b=b-0.02;
+ }
+ else if (snelheid_motor2 < 4.9) && (snelheid_motor2 != 0){
+ b=b+0.02;
+ }
+ else {
+ a=a;
+ b=b;
+ }
+
tickerflag = 0;
}
}
