I have been having problems regarding my Auto straightening code.
When the button is pressed to make the lift lift, it doesn’t per say skip, but as it moves the motors are very fidgety and it moves very slow. When it goes down on an identical but reversed code, it moves perfectly fine. My code for auto straightening is as follow;
if(vexRT[Btn6U] == 1)
{
//left slower than Right
if(SensorValue((LeftLift) < (RightLift))&& (vexRT[Btn6U]==1))
{
motor[LeftLift1]=127;
motor[LeftLift2]=127;
motor[RightLift1]=60;
motor[RightLift2]=60;
}
//Right slower than left
if(SensorValue((LeftLift) > (RightLift))&& (vexRT[Btn6U]==1))
{
motor[RightLift1]=127;
motor[RightLift2]=127;
motor[LeftLift1]=60;
motor[LeftLift2]=60;
}
//Motors are equal
if(SensorValue((LeftLift) == (RightLift))&& (vexRT[Btn6U]==1))
{
motor[RightLift1]=80;
motor[RightLift2]=80;
motor[LeftLift1]=80;
motor[LeftLift2]=80;
}
}
else
{
motor[RightLift1]=0;
motor[RightLift2]=0;
motor[LeftLift1]=0;
motor[LeftLift2]=0;
}
//down
if(vexRT[Btn6D] == 1)
{
SensorValue(LeftLift)=0;
SensorValue(RightLift)=0;
//left slower than Right
if(SensorValue((LeftLift) < (RightLift))&& (vexRT[Btn6D]==1))
{
motor[LeftLift1]=-40;
motor[LeftLift2]=-40;
motor[RightLift1]=-60;
motor[RightLift2]=-60;
}
//Right slower than left
if(SensorValue((LeftLift) > (RightLift))&& (vexRT[Btn6D]==1))
{
motor[RightLift1]=-40;
motor[RightLift2]=-40;
motor[LeftLift1]=-60;
motor[LeftLift2]=-60;
}
//Motors are equal
if(SensorValue((LeftLift) == (RightLift))&& (vexRT[Btn6D]==1))
{
motor[RightLift1]=-60;
motor[RightLift2]=-60;
motor[LeftLift1]=-60;
motor[LeftLift2]=-60;
}
}
else
{
motor[RightLift1]=0;
motor[RightLift2]=0;
motor[LeftLift1]=0;
motor[LeftLift2]=0;
}
Thanks in Advance!