Line Robot - Basic lessons - Exercises - Function catch
One more lesson for RCJ Rescue Line.
Task: modify function to catch a ball.
armCatch() is a predefined function which should catch a ball. It may look like this:
void RobotLine::armCatch() {
servo(LIFT_SERVO_DOWN, 0);
servo(CATCH_SERVO_CLOSE, 1);
servo(BLOCK_SERVO_BOTH, 2);
servo(ROTATE_SERVO_DOWN, 3);
}
We will use the servo motors 0 and 1, so the last 2 instructions are not needed. Also, if they stay in code, they will do no harm. Change the constants in the first 2 lines so that the arm really goes into appropriate position and call this function once from "loop()".
Solution
void RobotLine::loop() {
armCatch();
end();
}
"armCatch()" will be the same as above, but You will have to try various parameters.