Engine control program with 3 engines Needs to make a case for each simultaneous engine setting, because of the WAIT after each number of bits have been sent.
Dependencies: mbed-rtos mbed PinDetect
Fork of FinalMotorControl by
Diff: main.cpp
- Revision:
- 28:dac262b7ab32
- Parent:
- 27:35c962e8e95b
- Child:
- 29:00f839aad30e
--- a/main.cpp Wed Jun 01 17:40:54 2016 +0000 +++ b/main.cpp Thu Jun 02 07:53:41 2016 +0000 @@ -33,6 +33,9 @@ DigitalOut IN11(D5); DigitalOut IN12(D6); +//User button +DigitalIn SW(USER_BUTTON); + static int speed = 1750; static int bootStep1 = 100; @@ -630,7 +633,7 @@ // Move motor in one direction while (true) { - speed = 2000; + while(bootStep1 >= 0) { @@ -689,13 +692,26 @@ if (e3 == false) { //pc.printf("HALLO"); + m_cmd = "z"; Thread::wait(1000); break; }//end if } + //normal runtime while (true) { + + //user button to turn off engines + if(SW==1) + { + //put engines to sleep + m_cmd ="z"; + + + } + //set the speed. Higher = slower + speed = 2000; //speed = 1500; switch (m_cmd) @@ -782,6 +798,8 @@ if (cmd == 'x') { hold(); + Thread::wait(1000); + m_cmd = 'z'; } @@ -879,7 +897,7 @@ steps3--; } - m_cmd = 'x'; + //m_cmd = 'x'; }