Basic motor code
Dependencies: Motordriver mbed HALLFX_ENCODER Servo
Diff: main.cpp
- Revision:
- 9:aa739588a86b
- Parent:
- 8:e90d9ce42b33
- Child:
- 10:9066603296bd
- Child:
- 11:913a68b39fe0
--- a/main.cpp Tue May 01 15:07:14 2018 +0000 +++ b/main.cpp Tue May 01 15:25:31 2018 +0000 @@ -123,6 +123,41 @@ wait(0.1); } +void makeSquare(int sideLength) { + forward(sideLength); + turn(90); + forward(sideLength); + turn(90); + forward(sideLength); + turn(90); + forward(sideLength); + turn(90); +} + +void makeTriangle(int sideLength) { + forward(sideLength); + turn(120); + forward(sideLength); + turn(120); + forward(sideLength); + turn(120); +} + +void makeHexagon(int sideLength) { + forward(sideLength); + turn(60); + forward(sideLength); + turn(60); + forward(sideLength); + turn(60); + forward(sideLength); + turn(60); + forward(sideLength); + turn(60); + forward(sideLength); + turn(60); +} + void manualCheck() { leftEnc.reset(); rightEnc.reset(); @@ -171,14 +206,9 @@ int main() { penDown(); + makeHexagon(3); //makeCircle(); - - forward(5.0); - turn(120); - forward(5.0); - turn(120); - forward(5.0); - turn(120); +// makeTriangle(); //forward(5.0); //turn(90);