partner controller help

I added pneumatics on to the partner controller and when i did everything programed to that controller stopped working I tried removing the pneumatics from the code and it still didn’t work, I even tried moving the partner controller code to the main controller and it still didn’t work. every thing that was originally on the main controller still works which is just the base motors. can anyone help me?

Is this in easyC or RobotC

i am using robotC

You should post your code.

Could the batteries be in need of recharging?

task usercontrol()
{
// User control code here, inside the loop

while (true)
{

	///Base control for right side
	motor[baseFrontRight] = vexRT[Ch2];//added three motors to left and right side
	motor[baseBackRight] = vexRT[Ch2];
	motor[baseMiddleRight] = vexRT[Ch2];
	///Base control for Left side
	motor[baseFrontLeft] = vexRT[Ch3];
	motor[baseBackLeft] = vexRT[Ch3];
	motor[baseMiddleLeft] = vexRT[Ch3];
	///Tower control for right side
	motor[port9] = vexRT[Ch2Xmtr2];
	motor[port6] = vexRT[Ch2Xmtr2];
	///Tower control for left side
	motor[port2] = vexRT[Ch2Xmtr2];
	motor[port5]= vexRT[Ch2Xmtr2];

if(vexRT [Btn5UXmtr2]==1){
SensorValue[claw1] = 1;

}
}
}

I know it’s not programed right i was trying different ways to try and trouble shoot the problem

What does SensorValue[claw1] = 1; do?

Also, do you know how to wrap your code in code tags so it displays a little better?

no I don’t know how to wrap my code in code tages sorry and believe SensorValue[claw1] = 1; is suppose to activate the piston when the button is pushed not to sure i am still pretty new to programing.

Use the code tags button and it will look nice like this:


Your code here

[ATTACH]8620[/ATTACH]

The way it’s programmed right now, it will set the port to 1 when you press the button, but will never set it back to 0.

You could add

else if(vexRT [Btn5DXmtr2]==1){
SensorValue[claw1] = 0;
}


2014-10-03 15_53_49-VEX Forum - Reply to Topic.jpg

ok thanks but I still have the problem of nothing working on the partner controller, it’s not the controller because I tried use a different partner controller and it still did not work

#pragma config(Sensor, dgtl1,  claw1,          sensorDigitalOut)
#pragma config(Motor,  port1,           baseMiddleRight, tmotorVex393_HBridge, openLoop, reversed)
#pragma config(Motor,  port2,           leftTowerOne,  tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port3,           baseBackRight, tmotorVex393_MC29, openLoop,)
#pragma config(Motor,  port4,           baseFrontRight, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port5,           leftTowerTwo,  tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           rightTowerTwo, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port7,           baseFrontLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port8,           baseBackLeft,  tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port9,           rightTowerOne, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port10,          baseMiddleLeft, tmotorVex393_HBridge, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c"   //Main competition background code...do not modify!
void stop_()
{
	motor[port1] = 0;
	motor[port2] = 0;
	motor[port3] = 0;
	motor[port4] = 0;
	motor[port5] = 0;
	motor[port6] = 0;
	motor[port7] = 0;
	motor[port8] = 0;
	motor[port9] = 0;
	motor[port10] = 0;
}
void turnLeft(int x, int time)
{
	motor[baseBackLeft] = -x;
	motor[baseFrontLeft] = -x;
	motor[baseBackRight] = x;
	motor[baseFrontRight] = x;
	wait1Msec(time);
	stop_();
}

void turnRight(int y, int time)
{
	motor[baseBackLeft] = -y;
	motor[baseFrontLeft] = -y;
	motor[baseBackRight] = y;
	motor[baseFrontRight] = y;
	wait1Msec(time);
	stop_();
}

void forwards(int j, int time)
{
	if(j < 0)
	{
		motor[baseBackLeft] = -j;
		motor[baseFrontLeft] = -j;
		motor[baseBackRight] = -j;
		motor[baseFrontRight] = -j;
		wait1Msec(time);
		stop_();
	}
	else
	{
		motor[baseBackLeft] = j;
		motor[baseFrontLeft] = j;
		motor[baseBackRight] = j;
		motor[baseFrontRight] = j;
		wait1Msec(time);
		stop_();
	}
}

void backwards(int k, int time)
{
	if(k > 0)
	{
		motor[baseBackLeft] = -k;
		motor[baseFrontLeft] = -k;
		motor[baseBackRight] = -k;
		motor[baseFrontRight] = -k;
		wait1Msec(time);
		stop_();
	}
	else
	{
		motor[baseBackLeft] = k;
		motor[baseFrontLeft] = k;
		motor[baseBackRight] = k;
		motor[baseFrontRight] = k;
		wait1Msec(time);
		stop_();
	}
}

void openClaw()
{
	SensorValue[claw1] = 1;
}

void closeClaw()
{
	SensorValue[claw1] = 0;
}

void liftArm(int g, int time)
{
	if(g < 0)
	{
		motor[leftTowerOne] = -g;
		motor[rightTowerOne] = -g;
		wait1Msec(time);
		stop_();
	}
	else
	{
		motor[leftTowerOne] = g;
		motor[rightTowerOne] = g;
		wait1Msec(time);
		stop_();
	}
}

void lowerArm(int g, int time)
{
	if(g > 0)
	{
		motor[leftTowerOne] = g;
		motor[rightTowerOne] = g;
		wait1Msec(time);
		stop_();
	}
	else
	{
		motor[leftTowerOne] = -g;
		motor[rightTowerOne] = -g;
		wait1Msec(time);
		stop_();
	}
}



void pre_auton()
{
	// Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
	// Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.
	bStopTasksBetweenModes = true;

	// All activities that occur before the competition starts
	// Example: clearing encoders, setting servo positions, ...
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 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.
//
/////////////////////////////////////////////////////////////////////////////////////////

task autonomous()
{
	//Formatted as (Motor speed, time in milliseconds)
	openClaw();
	turnLeft(127, 1000);
	liftArm(127, 1000);
	forwards(127, 1000);
	closeClaw();
	turnRight(127, 1000);
	forwards(127, 1000);
	openClaw();
	turnLeft(127, 1000);
	liftArm(127, 1000);
	forwards(127, 1000);
	closeClaw();
	turnRight(127, 100);
	forwards(127, 1000);
	openClaw();

}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 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)
	{

		///Base control for right side
		motor[baseFrontRight] = vexRT[Ch2];//added three motors to left and right side
		motor[baseBackRight] = vexRT[Ch2];
		motor[baseMiddleRight] = vexRT[Ch2];
		///Base control for Left side
		motor[baseFrontLeft] = vexRT[Ch3];
		motor[baseBackLeft] = vexRT[Ch3];
		motor[baseMiddleLeft] = vexRT[Ch3];
		///Tower control for right side
		motor[port9] = vexRT[Ch2Xmtr2];
		motor[port6] = vexRT[Ch2Xmtr2];
		///Tower control for left side
		motor[port2] = vexRT[Ch2Xmtr2];
		motor[port5]= vexRT[Ch2Xmtr2];

	if(vexRT [Btn5UXmtr2]==1){
	SensorValue[claw1] = 1;
}
	else if(vexRT [Btn5DXmtr2]==1){
	SensorValue[claw1] = 0;
		}
	}
}
	

there is my entire code

Would this work?



if(vexRT [Btn5UXmtr2]==1)
//If the button is pressed, activate the claw's piston...
{
SensorValue[claw1] = 1;
}

else
//Otherwise, apply no pressure to the claw's piston...
{
SensorValue[claw1] = 0;
}


In your posted code, you have some defined functions, openClaw() and **closeClaw() **but you seem to be using SensorValue[claw1] = 1; instead of those defined functions. Is there a reason for that?

EDIT: Disregard my previous comment about if(vexRT [Btn5UXmtr2]==1).

Perhaps, your partner controller cable is bad? Either I’m missing something (not unlikely) or it’s a hardware problem. Your “tower motors” and the claw are not working, right? It’s not just the pneumatics.

It looks like you’re using the competition template. I suppose you’re using the competition switch with that?

yes the tower motors and the pneumatics don’t work, and the openclaw() and close() are you talking about the void or Autonomous. sorry I don’t under stand much of this code as I am working on it with my teams programmer. we have a programmer his name is nick he does most of the programing and their is me I am kind of the co-programmer.

I think nick originally programed the pneumatics so it is a toggle on button 5U so you push it and it extends then you push it again and it comes in

I think Highwayman is trying to get you to systematically isolate the problem and not try to change too many things all at once. If your partner controller is not working at all, it could be that the “phone” cord that connects the main joystick controller to your partner controller is not working. Or it could be that your partner controller batteries are dead.

If you are using the competition switch, you need to make sure you have it switched to “Driver” and “Enable”. Otherwise I think your robot might sit around waiting for permission to run its autonomous code. However, if you can run everything else located on the main controller then this is obviously not the problem.

I don’t think its the cord because the problem started when we added the code for the pneumatics but ill try it anyway just in case, other then that is their anything else it could be?