Test servo, IR sensor, and motor setup on Sparkfun Shadow robot base
Dependencies: Motordriver mbed
Fork of Magician_Motor_Test by
Revision 0:5c26b3940003, committed 2011-10-26
- Comitter:
- 4180_1
- Date:
- Wed Oct 26 01:12:51 2011 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 5c26b3940003 Motordriver.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motordriver.lib Wed Oct 26 01:12:51 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/littlexc/code/Motordriver/#3110b9209d3c
diff -r 000000000000 -r 5c26b3940003 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 26 01:12:51 2011 +0000 @@ -0,0 +1,28 @@ +// Magician robot motor test + +#include "mbed.h" +#include "motordriver.h" + +DigitalOut myled(LED1); + +//See http://mbed.org/cookbook/Motor +//Connections to dual H-brdige driver for the two drive motors +Motor left(p21, p22, p23, 1); // pwm, fwd, rev, has brake feature +Motor right(p26, p25, p24, 1); + +int main() { + while (1) { + myled=1; +// Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0) + for (float s= -1.0; s < 1.0 ; s += 0.01) { + left.speed(s); + right.speed(s); + wait(0.02); + } +// Turn off motors - coast one and brake one + left.coast(); + right.stop(1); + myled=0; + wait(1); + } +}
diff -r 000000000000 -r 5c26b3940003 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 26 01:12:51 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e