this is the demo for the dancing robot for ECE 4180
Dependencies: Motordriver mbed
Diff: main.cpp
- Revision:
- 0:a05a28ae0c99
diff -r 000000000000 -r a05a28ae0c99 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 08 21:45:46 2017 +0000 @@ -0,0 +1,28 @@ +// test code, this demonstrates working motor drivers. +// full reverse to full stop, dynamicaly brake and switch off. +#include "motordriver.h" +Motor A(p25, p20, p19, 1); // pwm, fwd, rev, can brake +Motor B(p24, p18, p17, 1); // pwm, fwd, rev, can brake + +int main() { + for (float s= -1.0; s < 1.0 ; s += 0.01) { + A.speed(s); + B.speed(s); + wait(0.02); + } + A.stop(1.0); + B.stop(1.0); + wait(1); + A.coast(); + B.coast(); + for (float s= -1.0; s < 1.0 ; s += 0.01) { + A.speed(s); + B.speed(-s); + wait(0.02); + } + A.stop(1.0); + B.stop(1.0); + wait(1); + A.coast(); + B.coast(); +} \ No newline at end of file