do you guys want the whole code
#pragma config(Sensor, in1, pontmojo, sensorPotentiometer)
#pragma config(Sensor, dgtl3, motorencoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl8, armencoder, sensorQuadEncoder)
#pragma config(Motor, port2, bothrightmotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, bothleftmotor, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port4, mojo1, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, mojo2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, lift1, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port7, lift2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, chain1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, chain2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, claw, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/*---------------------------------------------------------------------------*/
/* */
/* Description: Competition template for VEX EDR */
/* */
/*---------------------------------------------------------------------------*/
// 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"
/*---------------------------------------------------------------------------*/
/* Pre-Autonomous Functions */
/* */
/* You may want to perform some actions before the competition starts. */
/* Do them in the following function. You must return from this function */
/* or the autonomous and usercontrol tasks will not be started. This */
/* function is only called once after the cortex has been powered on and */
/* not every time that the robot is disabled. */
/*---------------------------------------------------------------------------*/
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
//void for drive
void drive(int distance, int speed)
{
SensorValue[motorencoder] = 0;
motor[bothrightmotor] = speed;
motor[bothleftmotor] = speed;
while(abs(SensorValue[motorencoder]) < distance) {
//...wait...and wait...
wait1Msec(15);
}
motor[bothrightmotor] = 0;
motor[bothleftmotor] = 0;
}
//void for turn drive
void turndrive(int distance, int speed)
{
SensorValue[motorencoder] = 0;
motor[bothrightmotor] = speed;
motor[bothleftmotor] = -speed;
while(abs(SensorValue[motorencoder]) < distance) {
//...wait...and wait...
wait1Msec(15);
}
motor[bothrightmotor] = 0;
motor[bothleftmotor] = 0;
}
//void for mojo
void mojo(int angle, int speed)
{
while(SensorValue[pontmojo] < angle)
{
motor[mojo1] = -127;
motor[mojo2] = -127;
}
while(SensorValue[pontmojo] > angle)
{
motor[mojo1] = 127;
motor[mojo2] = 127;
}
motor[mojo1] = 0;
motor[mojo2] = 0;
}
//void for armP
int target;
task armP
{
const float kp = 2.2;
float error;
int speed;
while(true)
{
error = (target - SensorValue [armencoder]);
speed = kp*error;
motor[chain1] = -speed;
motor[chain2] = -speed;
wait1Msec(15);
}
}
//VOID FOR DRIVEPD
void drivePD(int target)
{
const float Kp = .6; //must test for this value, I am just making it up
const float Kd = .9;//must test for this value, I am just making it up
int error;
int derivative;
int previousError;
int motorSpeed;
bool bContinue = true;
while(bContinue) //this is what you need in order to keep checking the sensor
{
error = target - SensorValue[motorencoder];
derivative = error - previousError;
previousError = error;
motorSpeed = (error*Kp) + (derivative*Kd);
motor[bothrightmotor] = motorSpeed;
motor[bothleftmotor] = motorSpeed;
if(fabs(error)> 5){
}
else
{
bContinue = false;
}
wait1Msec(20);
}
}
//VOID FOR TURNDRIVEPD
void turndrivePD(int target)
{
SensorValue[motorencoder] = 0;
const float Kp = .6; //must test for this value, I am just making it up
const float Kd = .9;//must test for this value, I am just making it up
int error;
int derivative;
int previousError;
int motorSpeed;
bool bContinue = true;
while(bContinue) //this is what you need in order to keep checking the sensor
{
error = target - SensorValue[motorencoder];
derivative = error - previousError;
previousError = error;
motorSpeed = (error*Kp) + (derivative*Kd);
motor[bothrightmotor] = -motorSpeed;
motor[bothleftmotor] = motorSpeed;
if(fabs(error)> 5){
}
else
{
bContinue = false;
}
wait1Msec(20);
}
}
void pre_auton()
{
SensorValue[motorencoder] = 0;
SensorValue[armencoder] = 0;
}
/*---------------------------------------------------------------------------*/
/* */
/* Autonomous Task */
/* */
/* This task is used to control your robot during the autonomous phase of */
/* a VEX Competition. */
/* */
/* You must modify the code to add your own robot specific commands here. */
/*---------------------------------------------------------------------------*/
//315 for turndrive for 90 degrees
//167.5 for turndrive for 45 degrees
//29 ticks equalls 1 inch
task autonomous()
{
time1[T4] = 0;
target = 100;
startTask(armP);
wait1Msec (400);
mojo(3050,90);
drivePD(1300);
mojo (1230,127);
target = 52;
wait1Msec (600);
motor [claw] = -127;
wait1Msec (250);
drivePD(100);
turndrivePD(635);
drivePD(700);
//wait1Msec (250); //pause for .025 seconds*//
//mojo(3135, -127); //put down mojo
//wait1Msec(250);
//drive(1300, 127); //drive forward
//wait1Msec(250);
//mojo(1230, 100); //pick up mobile goal
//wait1Msec(250);
//drive(800,-127); //drive backward
//wait1Msec(250);
//turndrive(500, 127); //turn
//wait1Msec(250);
//drive(350, 127); //drive forward
//wait1Msec(250);
//turndrive(125, 127); //turn
//wait1Msec(250);
//drive(450, 127); //drive forward
//wait1Msec(250);
//mojo(3135, -127); //put down mojo
//wait1Msec(250);
//drive(300,-127); //drive backward
//mojo(1075, 100); //pick up mobile goal
//wait1Msec(250);
writeDebugStreamLine("Total auto time: %d", time1[T4]);
}
/*---------------------------------------------------------------------------*/
/* */
/* User Control Task */
/* */
/* This task is used to control your robot during the user control phase of */
/* a VEX Competition. */
/* */
/* You must modify the code to add your own robot specific commands here. */
/*---------------------------------------------------------------------------*/
task usercontrol()
{
// User control code here, inside the loop
while (true)
{
//DRIVE
motor[bothrightmotor] = vexRT[Ch3]*.7;
motor[bothleftmotor] = vexRT[Ch2]*.7;
// This is the main execution loop for the user control program.
// Each time through8 the loop your program should update motor + servo
// values based on feedback from the joysticks.
// ........................................................................
// Insert user code here. This is where you use the joystick values to
// update your motors, etc.
// ........................................................................
//MOBILE GOAL
if (vexRT[Btn6D] == 1)
{
motor[mojo1] = -127*.7;
motor[mojo2] = -127*.7;
}
else if (vexRT[Btn6U] == 1)
{
motor[mojo1] = 127;
motor[mojo2] = 127;
}
else
{
motor[mojo1] = 0;
motor[mojo2] = 0;
}
//lift
if (vexRT[Btn5UXmtr2] == 1)
{
motor[lift1] = 127;
motor[lift2] = 127;
}
else if (vexRT[Btn5DXmtr2] == 1)
{
motor[lift1] = -127;
motor[lift2] = -127;
}
else
{
motor[lift1] = 0;
motor[lift2] = 0;
}
//Chainbar
if (vexRT[Btn6UXmtr2] == 1)
{
motor[chain1] = 127;
motor[chain2] = 127;
}
else if (vexRT[Btn6DXmtr2] == 1)
{
motor[chain1] = -127;
motor[chain2] = -127;
}
else
{
motor[chain1] = 0;
motor[chain2] = 0;
}
//true
bool closingClaw = false;
// in the while loop
if(vexRT[Btn7UXmtr2] == 1) {
motor[claw] = 127; // open the claw
closingClaw = false;
}
else if(vexRT[Btn7DXmtr2] == 1) {
motor[claw] = -127; // close the claw
closingClaw = true;
}
else if(closingClaw) {
motor[claw] = -20; // hold it closed
}
else {
motor[claw] = 0; // leave it open
}
}
}
and i dont have any rubberbands
thanks for the help