![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
asdf
Revision 0:c4ec289ae3a7, committed 2013-03-20
- Comitter:
- madcowswe
- Date:
- Wed Mar 20 17:30:30 2013 +0000
- Commit message:
- first commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r c4ec289ae3a7 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 20 17:30:30 2013 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" +DigitalOut EN(p25); +PwmOut IN1(p21); +PwmOut IN2(p22); +PwmOut IN3(p23); +PwmOut IN4(p24); + +//from -1 to 1 +void motorpower(float left, float right){ + IN1 = right < 0 ? -right : 0; + IN2 = right >= 0 ? right : 0; + IN3 = left >= 0 ? left : 0; + IN4 = left < 0 ? -left : 0; +} + +int main() { + + motorpower(0, 0); + EN = 1; + + while(1) { + wait(1); + motorpower(0.2, 0.2); + wait(1); + motorpower(-0.2, 0.2); + wait(1); + motorpower(0,0); + } +}
diff -r 000000000000 -r c4ec289ae3a7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 20 17:30:30 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0954ebd79f59 \ No newline at end of file