We are trying to make our claw move to two predetermined positions using two different buttons on the remote. This should be simple, but for some reason, I’m not getting it to work. If i take the code for one of the positions out, it seems to work, but add the other code, which is identical, it won’t work. also if I remove the UserControlCodePlaceholderForTesting(); out of the code, the program won’t work at all. What am I doing wrong?
#pragma config(Sensor, in1, claw_S, sensorPotentiometer)
#pragma config(Motor, port1, LeftFBaseM, tmotorVex393_HBridge, openLoop, driveLeft)
#pragma config(Motor, port2, RightBBaseM, tmotorVex393_MC29, openLoop, driveRight)
#pragma config(Motor, port3, RightFBaseM, tmotorVex393_MC29, openLoop, driveRight)
#pragma config(Motor, port4, LeftTowerM, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, LeftTowerM, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port6, RightTowerM, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, RightTowerM, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, LeftBBaseM, tmotorVex393_HBridge, openLoop, driveLeft)
// This code is for the VEX cortex platform
#pragma platform(VEX2)
// Select Download method as “competition”
#pragma competitionControl(Competition)
//Main competition background code…do not modify!
#include “Vex_Competition_Includes.c”
void pre_auton()
{
bStopTasksBetweenModes = true;
}
task autonomous()
{
AutonomousCodePlaceholderForTesting();
}
task usercontrol()
{
while (true)
{
motor[port2] = - vexRT[Ch2] + vexRT[Ch1]; //moveing
motor[port3] = - vexRT[Ch2] + vexRT[Ch1]; //moveing
motor[port4] = - vexRT[Ch3]; //arms
motor[port5] = - vexRT[Ch3]; //arms
motor[port6] = - vexRT[Ch3]; //arms
motor[port7] = - vexRT[Ch3]; //arms
motor[port8] = + vexRT[Ch2] + vexRT[Ch1]; //moveing
motor[port9] = + vexRT[Ch2] + vexRT[Ch1]; //moveing
if(vexRT[Btn6U] == 1) // baseich funcshin of the claw
{
motor[port1] = 127; motor[port10] = 127;
}
else if(vexRT[Btn6D] == 1)
{
motor[port1] = -127; motor[port10] = -127;
}
else
{
if(SensorValue[in1] > 2400)
{
motor[port1] = 40; motor[port10] = 40;
}
else
{
motor[port1] = 0; motor[port10] = 0;
}
}
if(vexRT[Btn5U] == 1) // grab poistin
{
if(SensorValue[in1] > 2300) //gos back when it went to far
{
motor[port1] = -50; motor[port10] = -50;
}
else if(SensorValue[in1] < 2500) //gos to the postin
{
motor[port1] = 90; motor[port10] = 90;
}
else(SensorValue[in1] == 2100); // just stops went it gets there
{
motor[port1] = 0; motor[port10] = 0;
}
}
if (vexRT[Btn7D] == 1) // levels out
{
if(SensorValue[in1] > 1900) //gos back when it went to far
{
motor[port1] = -50; motor[port10] = -50;
}
else if(SensorValue[in1] < 1700) //gos to the postin
{
motor[port1] = 90; motor[port10] = 90;
}
else if(SensorValue[in1] == 1800) // just stops went it gets there
{
motor[port1] = 0; motor[port10] = 0;
}
UserControlCodePlaceholderForTesting();
}
}
}