encoder verwerkt
Dependencies: MODSERIAL QEI mbed
Fork of motor_control by
Diff: main.cpp
- Revision:
- 3:a50f2ce05e1f
- Parent:
- 2:80753272d9e4
- Child:
- 4:d39f84608204
diff -r 80753272d9e4 -r a50f2ce05e1f main.cpp --- a/main.cpp Fri Sep 30 11:46:13 2016 +0000 +++ b/main.cpp Fri Sep 30 11:48:01 2016 +0000 @@ -19,27 +19,14 @@ { pc.baud(115200); //contact maken met computer int counts; - while (knop==1){ //als knop is aan dan + while (knop==1) + { //als knop is aan dan led=1; motor = CCW; + pwm_motor1=2.5; QEI Encoder(D12,D13,NC,32); counts = Encoder.getPulses(); - pc.printf("encoder counts %i", counts); - - for (int a=0; a<5;a=a++){ - pwm_motor =a; - wait(2.0f); - } - - int a=0; - wait(1.0f); - motor=CW; - for (int a=1; a<5;a=a++){ - pwm_motor= a; - wait(1.0f); - } - a=0; - + pc.printf("encoder counts %i", counts); -} + } } \ No newline at end of file