Test to control motors
Dependencies: HIDScope_friso MODSERIAL QEI mbed
Diff: main.cpp
- Revision:
- 4:f6ca4f7793bd
- Parent:
- 3:62e950f20604
--- 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