David's line following code from the LVBots competition, 2015.

Dependencies:   GeneralDebouncer Pacer PololuEncoder mbed

Fork of DeadReckoning by David Grayson

motors.cpp

Committer:
DavidEGrayson
Date:
2014-02-20
Revision:
4:1b20a11765c8
Child:
5:01ad080dc4fa

File content as of revision 4:1b20a11765c8:

#include <mbed.h>

static PwmOut motor1Pwm(p26);
DigitalOut motor1Dir(p25);

static PwmOut motor2Pwm(p24);
DigitalOut motor2Dir(p23);


void motors_init()
{
    motor1Pwm.period_us(50);
    motor2Pwm.period_us(50);
}

void motors_speed_set(int16_t motor1_speed, int16_t motor2_speed)
{
    motor1Pwm.pulsewidth_us(motor1_speed);
    motor2Pwm.pulsewidth_us(motor2_speed);    
}