Motor control in Ticker
Dependencies: FastPWM MODSERIAL mbed QEI
Fork of Motorcontrol by
Diff: main.cpp
- Revision:
- 5:1e85f68b5580
- Parent:
- 4:7f7974aec29d
--- a/main.cpp Mon Oct 08 08:45:13 2018 +0000 +++ b/main.cpp Mon Oct 08 09:30:19 2018 +0000 @@ -6,15 +6,15 @@ Ticker Motorticker; Ticker Printticker; -FastPWM motor1_pwm(D5); -DigitalOut motor1_richting(D4); -FastPWM motor2_pwm(D6); -DigitalOut motor2_richting(D7); +FastPWM motor1_pwm(D6); +DigitalOut motor1_richting(D7); +FastPWM motor2_pwm(D5); +DigitalOut motor2_richting(D4); QEI encoder1(D10, D11, NC, 32); QEI encoder2(D12, D13, NC, 32); -AnalogIn pot1(A1); -AnalogIn pot2(A0); +AnalogIn pot1(A0); +AnalogIn pot2(A1); MODSERIAL pc(USBTX, USBRX); float AnalogVoltage1; @@ -30,7 +30,7 @@ float rel_pos1=encoder1.getPulses()/32.0/131.25*2.0*3.1416; float rel_pos2=encoder2.getPulses()/32.0/131.25*2.0*3.1416; - pc.printf("pot1 = %f \t pot2 = %f \t Counts1 = %f \t Counts2 = %f \r\n", AnalogVoltage1, AnalogVoltage2, rel_pos1, rel_pos2); + pc.printf("pot1 = %f \t pot2 = %f \t Position 1 = %f \t Position 2 = %f \r\n", AnalogVoltage1, AnalogVoltage2, rel_pos1, rel_pos2); } void Motor_control()