//Turns crank based on fuel type void turnFuel() { if(isClockwise) { fuelServo.SetDegree(180); moveForward(-1 * LOW_FORWARD,20); moveForward(LOW_FORWARD, 3); fuelServo.SetDegree(160); moveForward(-1 * LOW_FORWARD, 8); fuelServo.SetDegree(180); } else { fuelServo.SetDegree(0); moveForward(-1 * LOW_FORWARD,20); moveForward(LOW_FORWARD, 3); fuelServo.SetDegree(30); moveForward(-1 * LOW_FORWARD, 8); fuelServo.SetDegree(0); } Sleep(2.0); }
Algorithm for turnFuel:
- If turn is clockwise proceed to step 2, if not proceed to step 7.
- Set the fuel servo degree to 180.
- Move forward at a low speed.
- Set the fuel servo degree to 160.
- Back up and drive forward again.
- Set the fuel servo degree to 180. Proceed to step 12.
- Set the fuel servo degree to 0.
- Move forward.
- Set the servo degree to 30.
- Back up and drive forward again.
- Set fuel servo degree to 0.
- End function.