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 mbed
Fork of P_controller_motor_Bouke by
Diff: main.cpp
- Revision:
- 4:dfdfcb518e60
- Parent:
- 3:eee8d5461256
- Child:
- 5:8ea7a765c1f7
--- a/main.cpp Thu Sep 17 10:45:54 2015 +0000
+++ b/main.cpp Thu Sep 17 10:49:09 2015 +0000
@@ -5,7 +5,20 @@
// Define the HIDScope and Ticker object
HIDScope scope(1);
Ticker scopeTimer;
-
+
+// Define Encoder
+
+Encoder motorP(PTD0,PTC9,true);
+Serial pc(USBTX,USBRX);
+pc.baud(115200);
+while(1) {
+ wait(0.2);
+ pc.printf("pos: %d, speed %f \r\n",motor1.getPosition(), motor1.getSpeed());
+ }
+
+// Define Potmeter
+
+
////// P Motor Controller
// Controller gain
@@ -18,17 +31,8 @@
return Kp*error;
}
-#include "Encoder.h"
- *
- * Encoder motor1(PTD0,PTC9,true);
- * Serial pc(USBTX,USBRX);
- * pc.baud(115200);
- while(1) {
- wait(0.2);
- pc.printf("pos: %d, speed %f \r\n",motor1.getPosition(), motor1.getSpeed());
- }
-
-AnalogIn potmeter1(POT1);
+
+
// encoder1
// potmeter1
