Toggle for servo (goal clamp)

Tags:
Personhours: 1
Toggle for servo (goal clamp) By Jayesh

Task: Improve Toggle Servo Coding

Our goal today was to code for the servo, utilized by the goal clamp, to have a basic toggle to switch the open/closed mechanism. This was accomplished with a boolean value switch within an if/else group. Our boolean status is switched value and is initiated by the push of button 7 (right trigger for us). First the value of status is switched, initiating the gripperOpen or gripperClose methods. task control() { bool status = true; servoTarget[GoalClamp]=goalClosed; status=true; wait1Msec(1000); servoTarget[GoalClamp]=goalOpen; //hoo-ray wait1Msec(1000); while(true) { getJoystickSettings(joystick); if (joy1Btn(2) == 1 || joy2Btn(2) == 1) {servoTarget[GoalClamp]=goalClosed;} //PlayImmediateTone(1000, 5);} if (joy1Btn(4) == 1 || joy2Btn(4) == 1) {servoTarget[GoalClamp]=goalOpen;} //PlayImmediateTone(1000, 5);} if (joy1Btn(5) == 1 || joy2Btn(5) == 1) {motor[belt] = 100;} if (joy1Btn(6) == 1 || joy2Btn(6) == 1) {motor[belt] = 0;} } }

Reflections:

The simplicity of our design allows for easy fixes if needed and also makes it very readable. Withholding each if/else and alternating them with a while loop gives us accesskey to the code and with the working toggle will give us all the more opportunity to score maximum points.

Date | December 20, 2014