Basic motor code
Dependencies: Motordriver mbed HALLFX_ENCODER Servo
Diff: main.cpp
- Revision:
- 11:913a68b39fe0
- Parent:
- 9:aa739588a86b
--- a/main.cpp Tue May 01 15:25:31 2018 +0000 +++ b/main.cpp Tue May 01 16:15:43 2018 +0000 @@ -158,6 +158,38 @@ turn(60); } +void makePattern(string shape, int sideLength){ + if (shape.compare("triangle") == 0) { + makeTriangle(sideLength); + turn(120); + makeTriangle(sideLength); + turn(120); + makeTriangle(sideLength); + turn(120); + } else if (shape.compare("circle") == 0) { + makeCircle(sideLength); + turn(120); + makeCircle(sideLength); + turn(120); + makeCircle(sideLength); + turn(120); + } else if (shape.compare("hexagon") == 0) { + makeHexagon(sideLength); + turn(120); + makeHexagon(sideLength); + turn(120); + makeHexagon(sideLength); + turn(120); + } else if (shape.compare("square") == 0) { + makeSquare(sideLength); + turn(120); + makeSquare(sideLength); + turn(120); + makeSquare(sideLength); + turn(120); + } +} + void manualCheck() { leftEnc.reset(); rightEnc.reset();