MEM
/
ES_6_P4
Motori DC
Diff: main.cpp
- Revision:
- 0:f622df532a43
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 06 19:35:58 2016 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "Motor.h" + +Motor m1(D10, D8, D9); //pwm (E1), fwd (1A), rev (1B) +Motor m2(D5, D6, D7); //pwm (E2), fwd (2A), rev (2B) +DigitalIn button(PC_13); + +int main() { + while(1) { + if (button==0) { + m1.speed(0.6); + m2.speed(0.6); + wait(2); + m1.speed(-0.6); + m2.speed(-0.6); + wait(2); + } + else { + m1.speed(0); + m2.speed(0); + } + } +} \ No newline at end of file