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

Committer:
mariob
Date:
Sat Jun 14 21:56:12 2014 +0000
Revision:
0:5307ae36f268
example to test motion boards

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mariob 0:5307ae36f268 1 #include "dc_motor.hpp"
mariob 0:5307ae36f268 2
mariob 0:5307ae36f268 3 DC_motor::DC_motor (PinName ppwm, PinName pdir): pwm(ppwm), dir(pdir)
mariob 0:5307ae36f268 4 {
mariob 0:5307ae36f268 5 pwm.period(0.001);
mariob 0:5307ae36f268 6 pwm = 0;
mariob 0:5307ae36f268 7 dir = 0;
mariob 0:5307ae36f268 8 }
mariob 0:5307ae36f268 9
mariob 0:5307ae36f268 10 void DC_motor::speed (float speed)
mariob 0:5307ae36f268 11 {
mariob 0:5307ae36f268 12 dir = speed>0.0;
mariob 0:5307ae36f268 13 pwm = abs(speed);
mariob 0:5307ae36f268 14 }