My team is making a competition robot and are having some issues like drive motors starting one at a time and vex net keys not connecting
Ive been searching the internet for months and am starting to feel incompetent. So I was wondering is the fact we are using a vex EDR cortex the problem?
The Cortex works fine, POST SOME CODE or we cannot help you.
#pragma config(Motor, port2, frontRight, tmotorVex393HighSpeed_MC29, openLoop, driveRight)
#pragma config(Motor, port3, backRight, tmotorVex393HighSpeed_MC29, openLoop, driveRight)
#pragma config(Motor, port4, frontLeft, tmotorVex393HighSpeed_MC29, openLoop, driveLeft)
#pragma config(Motor, port5, backLeft, tmotorVex393HighSpeed_MC29, openLoop, driveLeft)
#pragma config(Motor, port6, armMotorleft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, armMotorright, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, Pickupmotor, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port9, lockMotor, tmotorServoStandard, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
task armLeft()(I have a code now for the arm I haven’t been able to test)
{
while (true)
{
if(vexRT[Btn6U] == 1)
{
motor[armMotorleft] = 127;
}
else
if(vexRT[Btn6D] == 1)
{
motor[armMotorleft] = -127;
}
else
{
motor[armMotorleft] = 0;
}
waitInMilliseconds(10);
}
}
task armRight()
{
while (true)
{
if(vexRT[Btn6U] == 1)
{
motor[armMotorright] = 127;
}
else if(vexRT[Btn6U] == 1)
{
motor[armMotorright] = -127;
}
else
{
motor[armMotorright] = 0;
}
waitInMilliseconds(10);
}
}
task pickup()(I’m going to try to use the same code here)
{
while (true)
{
if(vexRT[Btn5U] == 1)
{
motor[Pickupmotor] = 127;
}
else if(vexRT[Btn5D] == 1)
{
motor[Pickupmotor] = -127;
}
else
{
motor[Pickupmotor] = 0;
}
waitInMilliseconds(10);
}
}
task lock()(I haven’t been able to test the positions yet either)
{
while (true)
{
if(vexRT[Btn7L] == 1) //If the group 7 left button is pressed
{
motor[lockMotor] = 127; //then lock the axel
}
else if(vexRT[Btn7R] == 1) //But if the group 7 right button is pressed
{
motor[lockMotor] = -127; //then unlock the axel
}
else //But if no button is pressed
{
motor[lockMotor] = 0; //stop the servo.
}
waitInMilliseconds(10);
}
}
task main()
{
//Loop Forever
startTask(armLeft);
startTask(armRight);
startTask(pickup);
startTask(lock);
while(1 == 1)
{
//Remote Control Commands**(I'm hopefully getting help with this)**
motor[frontRight] = vexRT[Ch3] - vexRT[Ch1] + vexRT[Ch4];
motor[backRight] = vexRT[Ch3] - vexRT[Ch1] - vexRT[Ch4];
motor[frontLeft] = vexRT[Ch3] + vexRT[Ch1] - vexRT[Ch4];
motor[backLeft] = vexRT[Ch3] + vexRT[Ch1] + vexRT[Ch4];
}
waitInMilliseconds(10);
}
//one motor needs to be reversed
So I’m not really sure what you question is, the code was more or less correct, one small mistake in the armRight task (checking Btn6U twice), but otherwise worked.
VEXnet keys not connecting is unrelated to code, it’s been common with the old black keys for a long time. The new white keys are better.
What do you means by drive motors starting one at a time?
Here is your code revised, reformatted and the (only) natural language call replaced with the standard one, wait1Msec.
Use code tags when posting code, it makes reading it easier and keeps the formatting.
#pragma config(Motor, port2, frontRight, tmotorVex393HighSpeed_MC29, openLoop, driveRight)
#pragma config(Motor, port3, backRight, tmotorVex393HighSpeed_MC29, openLoop, driveRight)
#pragma config(Motor, port4, frontLeft, tmotorVex393HighSpeed_MC29, openLoop, driveLeft)
#pragma config(Motor, port5, backLeft, tmotorVex393HighSpeed_MC29, openLoop, driveLeft)
#pragma config(Motor, port6, armMotorleft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, armMotorright, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, Pickupmotor, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port9, lockMotor, tmotorServoStandard, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task armLeft()
{
while (true)
{
if(vexRT[Btn6U] == 1)
{
motor[armMotorleft] = 127;
}
else
if(vexRT[Btn6D] == 1)
{
motor[armMotorleft] = -127;
}
else
{
motor[armMotorleft] = 0;
}
wait1Msec(10);
}
}
task armRight()
{
while (true)
{
if(vexRT[Btn6U] == 1)
{
motor[armMotorright] = 127;
}
else
if(vexRT[Btn6D] == 1)
{
motor[armMotorright] = -127;
}
else
{
motor[armMotorright] = 0;
}
wait1Msec(10);
}
}
task pickup()
{
while (true)
{
if(vexRT[Btn5U] == 1)
{
motor[Pickupmotor] = 127;
}
else
if(vexRT[Btn5D] == 1)
{
motor[Pickupmotor] = -127;
}
else
{
motor[Pickupmotor] = 0;
}
wait1Msec(10);
}
}
task lock()
{
while (true)
{
if(vexRT[Btn7L] == 1) //If the group 7 left button is pressed
{
motor[lockMotor] = 127; //then lock the axel
}
else
if(vexRT[Btn7R] == 1) //But if the group 7 right button is pressed
{
motor[lockMotor] = -127; //then unlock the axel
}
else //But if no button is pressed
{
motor[lockMotor] = 0; //stop the servo.
}
wait1Msec(10);
}
}
task main()
{
// Start tasks
startTask(armLeft);
startTask(armRight);
startTask(pickup);
startTask(lock);
//Loop Forever
while(1 == 1)
{
//Remote Control Commands(I'm hopefully getting help with this)
motor[frontRight] = vexRT[Ch3] - vexRT[Ch1] + vexRT[Ch4];
motor[backRight] = vexRT[Ch3] - vexRT[Ch1] - vexRT[Ch4];
motor[frontLeft] = vexRT[Ch3] + vexRT[Ch1] - vexRT[Ch4];
motor[backLeft] = vexRT[Ch3] + vexRT[Ch1] + vexRT[Ch4];
wait1Msec(10);
}
}
//one motor needs to be reversed