Main Code
Dependencies: PinDetect Ulrasonic mbed-rtos mbed WTV020SD_Sound_Breakout_Library
Fork of MC by
Diff: main.cpp
- Revision:
- 22:f6e328f7bd28
- Parent:
- 21:9f3ae352ee63
- Child:
- 23:ad08a8eabc24
--- a/main.cpp Tue May 03 13:25:25 2016 +0000 +++ b/main.cpp Thu May 05 09:24:43 2016 +0000 @@ -21,7 +21,7 @@ DigitalOut IN12(D11); -static int fart = 1000; +static int fart = 1300; static char m_cmd = 'x'; @@ -368,7 +368,7 @@ } - Thread::wait(10); + Thread::wait(20); //pc.printf("%d", steps); } } @@ -377,19 +377,31 @@ { //Thread 1 has constant feed from usb Thread t1(input); - static char global_direction; + //static char global_direction; printf("Started"); + /* + + BOOT UP AND SYNCHRONIZE + + */ + + while (true) - { - //Thread::wait(5); + { + if(m_cmd == 'a') + { + stepAllRight(); + } + + else if (m_cmd == 'b') + { + stepAllLeft(); + + } /* - - - - else if (m_cmd == 'k') { int steps = 242; @@ -424,46 +436,45 @@ //Make all engines halt and hold still. if (m_cmd == 'x') { - Thread::wait(5); } //Controlling each motor seperately. //ENGINE 1 if(m_cmd == '7') { - //fart = 1200; + stopE1(); stepEngine1Left(); } else if (m_cmd == '9') { - //fart = 1200; + stopE1(); stepEngine1Right(); } //ENGINE 2 else if (m_cmd == '4') { - //fart = 1200; + stopE2(); stepEngine2Left(); } else if (m_cmd == '6') { - //fart = 1200; + stopE2(); stepEngine2Right(); } //ENGINE 3 else if (m_cmd == '1') { - //fart = 1200; + stopE3(); stepEngine3Left(); } else if (m_cmd == '3') { - //fart = 1200; + stopE3(); stepEngine3Right(); }