Hey guys, sorry to bother again. Right now I am stuck in the middle of a dilemma where I cannot figure out how to let my arm position function keep my arm at a certain height during certain segments of my auton.
Here are the two functions, and I am currently trying to get it so that when my arm is up, it stays at a set height of 700 ticks of the IME, and when I want my arm down, I can just set my height variable to 0.
void auton_3(){ //Undefined
SensorValue(claw) = 0; //Unfold
wait1Msec(1000);
a_drive('f'); //forward to pick up stars
wait1Msec(1000);
stop();
SensorValue(claw) = 1; //grab stars
a_drive('b'); //drive back
wait1Msec(800);
stop();
a_drive('>'); //turn left
wait1Msec(1000);
stop();
a_drive('u'); //lift arm up
wait1Msec(1500);
stop();
a_drive('f'); //drive forward
wait1Msec(1500);
stop();
SensorValue(claw) = 0; //drop stars
a_drive('<'); //turn right
wait1Msec(400);
stop();
a_drive('d'); //arm down
wait1Msec(1000);
stop();
a_drive('f'); //drive forward
wait1Msec(500);
stop();
SensorValue(claw) = 1; //grab cube
a_drive('<'); //turn right
wait1Msec(200);
stop();
a_drive('b'); //drive back
wait1Msec(500);
stop();
a_drive('u'); //lift up
wait1Msec(1500);
stop();
SensorValue(claw) = 0; //release cube
}
void arm_pos(int height){
if(SensorValue[IME] = height{
motor(lift1) = 0;
motor(lift2) = 0;
motor(lift3) = 0;
}
else if(SensorValue[IME] < height{
motor(lift1) = 127;
motor(lift2) = 127;
motor(lift3) = 127;
}
else if(SensorValue[IME] > height{
motor(lift1) = -127;
motor(lift2) = -127;
motor(lift3) = -127;
}
}
Note: In the beginning before auton, I have my IME set to read 0 before anything occurs so that down is 0 ticks, and up is a set value of 700ish ticks.