View unanswered posts | View active topics It is currently Tue Oct 21, 2014 8:59 pm






Reply to topic  [ 5 posts ] 
vex cortex motor port 1 and motor port 10 
Author Message
Rookie

Joined: Wed Jan 02, 2013 3:50 pm
Posts: 5
Post vex cortex motor port 1 and motor port 10
Recently got vex cortex micro controller with joystick and vexnet. Installed free trial of robot c from the internet and everything seems to work ok but for motor ports 1 and 10. When we try to make the motors move in ports 1 and 10 they just hum. Ran a sample program form robot c and the motors did work. Wondering if someone can tell us what might be wrong with what we are doing. Thanks

Team 3233
Fondy Heat FHS Cardinals


Wed Jan 02, 2013 3:57 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 592
Post Re: vex cortex motor port 1 and motor port 10
It seems like the program you are using may not have the motors configured correctly. Would you be able to post your code, including the #pragma statements at the top, on here using the [code][/code] tags? This will help us debug your program further.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Wed Jan 02, 2013 4:11 pm
Profile
Rookie

Joined: Wed Jan 02, 2013 3:50 pm
Posts: 5
Post Re: vex cortex motor port 1 and motor port 10
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#pragma platform(VEX)

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

#include "Vex_Competition_Includes.c" //Main competition background code...do not modify!

/////////////////////////////////////////////////////////////////////////////////////////
//
// Pre-Autonomous Functions
//
// You may want to perform some actions before the competition starts. Do them in the
// following function.
//
/////////////////////////////////////////////////////////////////////////////////////////

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()
{
// .....................................................................................
// Insert user code here.
// .....................................................................................

AutonomousCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
}

/////////////////////////////////////////////////////////////////////////////////////////
//
// 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)
{
// This is the main execution loop for the user control program. Each time through 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.
// .....................................................................................

bMotorFlippedMode[port6] = true;
bMotorFlippedMode[port8] = true;



motor[port1] = vexRT[Ch5];
motor[port2] = vexRT[Ch3]; // Remove this function call once you have "real" code.
motor[port4] = vexRT[Ch3];
motor[port6] = vexRT[Ch2];
motor[port8] = vexRT[Ch2];
motor[port10] = vexRT[Ch5];

if(vexRT[Btn6U] == 1)
{
motor[port3] = -127;
motor[port5] = -127;
motor[port7] = 127;
motor[port9] = 127;

}
else if(vexRT[Btn6D] == 1)
{
motor[port3] = 127;
motor[port5] = 127;
motor[port7] = -127;
motor[port9] = -127;
}
else
{
motor[port3] = 0;
motor[port5] = 0;
motor[port7] = 0;
motor[port9] = 0;
}

if(vexRT[Btn5U] == 1)
{
motor[port1] = -127;
motor[port10] = 127;


}
else if(vexRT[Btn5D] == 1)
{
motor[port1] = 127;
motor[port10] = -127;

}
else
{
motor[port1] = 0;
motor[port10] = 0;

}



}
}

this is what I have for my program.


Wed Jan 02, 2013 8:58 pm
Profile
Novice
User avatar

Joined: Sat Jul 10, 2010 3:06 pm
Posts: 86
Location: Roanoke, VA
Post Re: vex cortex motor port 1 and motor port 10
Please provide the lines that were above:

Code:
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//


Also, please use the code tags--this preserves the indentation of your code, making it much easier to read. Format it like this:
Code:
[code]
//Your program here.
[/code]

_________________
Check out my website! www.RoboDesigners.com

VRC Team 2190

Twitter: @RoboDesigners


Thu Jan 03, 2013 12:10 pm
Profile WWW
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 592
Post Re: vex cortex motor port 1 and motor port 10
Code:
motor[port1] = vexRT[Ch5];
motor[port10] = vexRT[Ch5];


These two lines are where your problem lies. You are referencing channel 5, but the newer VEXNet Joystick controller does not use a channel 5; channels 1-4 refer to the X and Y axes of the two joysticks, but channels 5 and 6 refer to the rear buttons on the older remote control. It is probably returning a value of 0, which is turning your motors off every time the program loops (and it loops extremely quickly).

The program will turn the motors on if the button is pressed, then almost immediately turn them off (milliseconds of difference in time). The reason the motors are humming is because they are being turned on and off so fast; they may turn very slowly, or they may do nothing at all depending on the weight of your robot, friction, gearing, etc. To test if this is the only problem, I would suggest commenting out the two lines I've posted and run the program without that; you can then reassign the ports as need be.

There is also a full listing of the current VEXNet commands used in ROBOTC on our wiki.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Thu Jan 03, 2013 12:50 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.