Hey all, I’m here to ask you all for some help with programming our lift. So the current setup is that we have a conveyor being powered by two motors in tandem. We have a piece of rib sticking out from the chain that contacts a button. When that button is pressed the conveyor is in perfect position to pick up mobile goals. Our problem is the code that is needed to stop the motor movement. Here is the portion of what we currently have working:
#pragma config(Motor, port1, intake, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, ldrive1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, ldrive2, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port4, ldrive3, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, lift, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, carousel, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, rdrive3, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port8, rdrive2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, rdrive1, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port10, mglift, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
int leftStickX;
int leftStickY;
int JOYSTICK_TOLERANCE = 15;
while(true)
{
if (abs(vexRT[Ch3]) > JOYSTICK_TOLERANCE)
{
leftStickY = vexRT[Ch3];
}
else
{
leftStickX = 0;
leftStickY = 0;
}
if (abs(vexRT[Ch1]))
{
leftStickX = vexRT[Ch1];
}
motor[ldrive1] = leftStickY + leftStickX;
motor[ldrive2] = leftStickY + leftStickX;
motor[ldrive3] = leftStickY + leftStickX;
//left side drive
motor[rdrive1] = leftStickY - leftStickX;
motor[rdrive2] = leftStickY - leftStickX;
motor[rdrive3] = leftStickY - leftStickX;
if(vexRT[Btn6U] == 1)
{motor[mglift] = 127;}
else if(vexRT[Btn6D] == 1)
{motor[mglift] = -127;
waitUntil(SensorValue(dgtl5) == 1);
motor[mglift] = 0;}
else
{motor[mglift] = 0;}
}
}
The problem with using the waitUntil command is that when it is added to our drive code it ends up freezing all motor values until the lift switch is pressed. So say I am driving forward and click the button to lower the lift you see my drive continue to drive straight. So what I have to ask you is how can I do this in a manner that alleviates our freezing issue?