Basic motor code
Dependencies: Motordriver mbed HALLFX_ENCODER Servo
Diff: main.cpp
- Revision:
- 12:b107ba24faa4
- Parent:
- 10:9066603296bd
- Child:
- 13:294c06406d06
--- a/main.cpp Tue May 01 16:11:08 2018 +0000 +++ b/main.cpp Tue May 01 16:17:24 2018 +0000 @@ -160,6 +160,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();