David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
Diff: motors.cpp
- Revision:
- 5:01ad080dc4fa
- Parent:
- 4:1b20a11765c8
- Child:
- 6:89a39870e23d
--- a/motors.cpp Thu Feb 20 22:59:28 2014 +0000 +++ b/motors.cpp Thu Feb 20 23:30:53 2014 +0000 @@ -11,10 +11,17 @@ { motor1Pwm.period_us(50); motor2Pwm.period_us(50); + motor1Pwm.pulsewidth_us(20); + motor2Pwm.pulsewidth_us(20); + + LPC_PWM1->MR0 = 1200; // Set the period + LPC_PWM1->MCR = (1 << 1); // Reset PWMTC when it is equal to MR0. + LPC_PWM1->MR1 = 10; + LPC_PWM1->MR3 = 600; } void motors_speed_set(int16_t motor1_speed, int16_t motor2_speed) { - motor1Pwm.pulsewidth_us(motor1_speed); - motor2Pwm.pulsewidth_us(motor2_speed); + //LPC_PWM1->MR0 = motor1_speed; + //LPC_PWM1->MR2 = motor2_speed; }