Program for testing motion boards (double motor controller)

Dependencies:   mbed

Program to test motion boards (double motor controller).

The mbed board reads from a joystick and then sends the commands to the motor board (l293d), which lets the small caterpillar go ahead, go back and turn.

/media/uploads/mariob/2014-06-14_23.36.59.jpg /media/uploads/mariob/2014-06-14_23.36.46.jpg

dc_motor.cpp

Committer:
mariob
Date:
2014-06-14
Revision:
0:5307ae36f268

File content as of revision 0:5307ae36f268:

#include "dc_motor.hpp"

DC_motor::DC_motor (PinName ppwm, PinName pdir): pwm(ppwm), dir(pdir)
{
    pwm.period(0.001);
    pwm = 0;
    dir = 0;
}

void DC_motor::speed (float speed)
{
    dir = speed>0.0;
    pwm = abs(speed);
}