Samenwerking Groep 12
Dependencies: Encoder MODSERIAL HIDScope mbed
Foo
Diff: main.cpp
- Revision:
- 24:465efbd884d5
- Parent:
- 23:34e97668550f
- Child:
- 25:75cce8f86272
--- a/main.cpp Tue Sep 22 14:31:54 2015 +0000 +++ b/main.cpp Tue Sep 22 15:06:17 2015 +0000 @@ -30,8 +30,9 @@ { double position=motor2.getPosition(); //current motor position double error=reference-position; + scope.set(0,motor2.getPosition()); + scope.send(); pc.printf("ik doe het positie = %d en error =%d en reference=%d \r\n", position, error, reference); - scope.set(0,motor2.getPosition()); return P(error,motor2_Kp); } @@ -48,14 +49,14 @@ } else { // If button is not pressed double output_motor = motor2_controller(); while(output_motor>0){ - motor2speed=output_motor; - motor2direction=1; - break;} - while(output_motor<0){ - motor2speed=fabs(output_motor); - motor2direction=0; - break;} - { + motor2speed=output_motor; + motor2direction=1; + break;} + while(output_motor<0){ + motor2speed=fabs(output_motor); + motor2direction=0; + break;} + { pc.printf("else loop controller"); } }