Test to control motors
Dependencies: HIDScope_friso MODSERIAL QEI mbed
Revision 4:f6ca4f7793bd, committed 2016-10-25
- Comitter:
- FR150
- Date:
- Tue Oct 25 12:41:15 2016 +0000
- Parent:
- 3:62e950f20604
- Commit message:
- PIDtest werkend
Changed in this revision
HIDScope.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 62e950f20604 -r f6ca4f7793bd HIDScope.lib --- a/HIDScope.lib Mon Oct 24 08:36:05 2016 +0000 +++ b/HIDScope.lib Tue Oct 25 12:41:15 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/tomlankhorst/code/HIDScope/#fb5729980160 +https://developer.mbed.org/users/FR150/code/HIDScope_friso/#fb5729980160
diff -r 62e950f20604 -r f6ca4f7793bd main.cpp --- a/main.cpp Mon Oct 24 08:36:05 2016 +0000 +++ b/main.cpp Tue Oct 25 12:41:15 2016 +0000 @@ -51,7 +51,7 @@ if (angleerror > 0) motor1_direction = 0; potmeter = potmeter1.read(); referencevelocity = potmeter*max_velocity; - motor1_pwm.pulsewidth(referencevelocity/max_velocity*0.020); + motor1_pwm.pulsewidth(fabs(angleerror)*3*referencevelocity/max_velocity*0.020); } void calculateangle() { //calculate the angle of the axis based on counts