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:
- 10:17a16ceb376b
- Parent:
- 9:1636083fce43
- Child:
- 11:ef54754100ea
--- a/main.cpp Tue Apr 26 12:05:57 2016 +0000 +++ b/main.cpp Tue Apr 26 13:10:22 2016 +0000 @@ -10,11 +10,12 @@ DigitalOut IN3(A2); DigitalOut IN4(A3); //Second engine 5-8 -/* + DigitalOut IN5(D3); DigitalOut IN6(D4); DigitalOut IN7(D5); -DigitalOut IN8(D6); +DigitalOut IN8(D6) +/* //Third engine 9-12 DigitalOut IN9(D8); DigitalOut IN10(D9); @@ -53,7 +54,7 @@ IN12=1; wait_us(fart); } - +*/ void step4Right2() { @@ -82,7 +83,7 @@ IN8=1; wait_us(fart); } -*/ + void step4Right1() { //engine 1 @@ -145,7 +146,7 @@ } - +*/ void step4Left2() { //engine 2 @@ -178,7 +179,7 @@ wait_us(fart); } -*/ + void step4Left1() { //engine 1 @@ -298,16 +299,23 @@ } else if (m_cmd == 'k') { - int steps = 50; + int steps1 = 50; + int steps2 = 50; //Steps = 242 gives a 60' rotation to the left. - while (steps >= 0) + while (steps1 >= 0) { step4Left1(); //step4Left2(); //step4Left3(); - steps--; + steps1--; + } + while (steps2 >= 0) + { + step4Left2(); + + steps2--; } m_cmd = 'x'; }