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: Encoder MODSERIAL HIDScope mbed
Revision 22:d22381fe3b16, committed 2015-09-22
- Comitter:
- ThomasBNL
- Date:
- Tue Sep 22 13:59:36 2015 +0000
- Parent:
- 21:fb17e0b8924e
- Child:
- 23:34e97668550f
- Commit message:
- hidscope implementeren
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Sep 22 13:47:11 2015 +0000
+++ b/main.cpp Tue Sep 22 13:59:36 2015 +0000
@@ -10,13 +10,14 @@
Encoder motor2(D13,D12,true); // The encoder is able to read and set position/speed values
MODSERIAL pc(USBTX,USBRX); // This input is used to send data to the pc
Ticker TickerController; // This adds a Ticker to the function +TickerController
+HIDScope scope(2);
//AnalogIn potmeter2(A0); /NIEUW
// Defining constants
double counts_per_revolution=4200;
double degrees_per_turn=360;
double counts_per_degree=counts_per_revolution/degrees_per_turn; //11.67 counts/degree
-const double motor2_Kp = 2.5; //controller gain which will be multiplied with the error (*how fast will the error be corrected)
+const double motor2_Kp = 1; //controller gain which will be multiplied with the error (*how fast will the error be corrected)
const double reference = 400;
// Function P-controller
@@ -53,7 +54,9 @@
motor2speed=fabs(output_motor);
motor2direction=0;
break;}
+ while(1){
pc.printf("else loop controller");
+ scope.set(0,motor2.getPosition());}
}
// while (Error_position > 0) {
