work but not jet as..
Dependencies: MODSERIAL mbed QEI
Fork of AllMoter_test by
it works for motor 1
Diff: main.cpp
- Revision:
- 4:7b8bf798bb72
- Parent:
- 3:dfb4b8d37bab
- Child:
- 5:353ed56417a2
--- a/main.cpp Fri Oct 14 10:09:44 2016 +0000 +++ b/main.cpp Fri Oct 14 10:34:17 2016 +0000 @@ -24,20 +24,20 @@ void GetDirections() { - if (rechts == 1) { + if ((rechts == 1) && (links == 1)) + {} + else if ((rechts == 1) && (draailinks == 0)) { draairechts = !draairechts; + } else if ((rechts == 1) && (draailinks == 1)) { draailinks = 0; - } else if (rechts == 0) { + draairechts = !draairechts; + } else if (links == 1) { + draailinks = !draailinks; + } else if ((links == 1) && (draairechts == 1)) { draairechts = 0; - } - - if (links == 1) { draailinks = !draailinks; - draairechts = 0; - } else if (links == 0) { - draailinks = 0; } - + wait(0.1); /*if ((rechts == 0) && (links == 0)) { draairechts = false; draailinks = false; @@ -70,11 +70,7 @@ } int main() { - pc.baud(115200); - pc.printf("hoi\n"); - M1_rotate = 1; - M2_rotate = 1; - M3_rotate = 1; + /* float GetReferenceVelocity() { @@ -147,6 +143,19 @@ while (true) { GetDirections(); + if (draairechts == true) { + M1_Speed = 0.5; + M1_rotate = 0; + } else if (draailinks == true) { + M1_Speed = 0.5; + M1_rotate = 1; + } else if ((draailinks == false) && (draairechts == false)) { + M1_Speed = 0; + } + + + + /* if ((draailinks == true) && (draairechts == false)) { M1_Speed = 0.5; M1_rotate = 0; @@ -156,9 +165,7 @@ } else { M1_Speed = 0; } - - - + */ /* float M2 = M2_rotate.read(); @@ -171,4 +178,5 @@ */ } + }