Hello Vex Community,
Our team is having problems with our driver control program. Nothing in the driver control program works except for our autostack task button but only if it is at the top of the usercontrol code. What needs to be done to make it work? Attached is some of our code.
Thanks in advance!
task autostack();
task usercontrol();
task usercontrol(){
motor[port8] = vexRT[Ch2]; //prt 8 right y
motor[port2] = vexRT[Ch3]; //prt 2 left y
motor[port3] = vexRT[Ch2]; //prt 3 right single
motor[port9] = vexRT[Ch3]; //prt 9 left single
//button6 (arm motors)
if(vexRT[Btn6U] == 1) //arm up
{
motor[port5] = -127;
motor[port6] = -127;
motor[port7] = -127;
}
else if(vexRT[Btn6D] == 1) //arm down
{
motor[port5] = 127;
motor[port6] = 127;
motor[port7] = 127;
}
else
{
motor[port5] = 0;
motor[port6] = 0;
motor[port7] = 0;
//button5 (mobile goal intake)
if(vexRT[Btn5U] == 1) //mobi up
{
motor[port4] = -127;
}
else if(vexRT[Btn5D] == 1) //mobi down
{
motor[port4] = 127;
}
else
{
motor[port1] = 0;
if(vexRT[Btn7U] == 1) //chain bar up
{
motor[port1] = 127;
}
else if(vexRT[Btn7D] == 1) //chain bar down
{
motor[port1] = -127;
}
else
{
motor[port1] = 0;
if(vexRT[Btn8U] == 1) //cone intake up
{
motor[port10] = 127;
}
else if(vexRT[Btn8D] == 1) // cone intake down
{
motor[port10] = -127;
}
else
{
motor[port10] = 0;
if(vexRT[Btn8R] == 1)
{
startTask(autostack);
}
else if(vexRT[Btn8L] == 1)
stopTask(autostack);
}
}
}
}
}
task autostack();
task t1();
task t2();
task t3();
task autostack()
{
if(SensorValue[rightultrasonic] == 11 || SensorValue[rightultrasonic] == 12 )
startTask(t1);
else if(SensorValue[rightultrasonic] == 13 || SensorValue[rightultrasonic] == 14)
startTask(t2);
else if(SensorValue[rightultrasonic] == 15 || SensorValue[rightultrasonic] == 16)
startTask(t3);
task t1();
....
task t2();
....
task t3();
....
}