Mario Bambagini / Mbed 2 deprecated caterpillar

Dependencies:   mbed

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 }