ROBOTC.net forums
http://www.robotc.net/forums/

Programming the arm
http://www.robotc.net/forums/viewtopic.php?f=11&t=12163
Page 1 of 1

Author:  roboglobal [ Thu Sep 10, 2015 4:20 pm ]
Post subject:  Programming the arm

I am not sure what I'm doing wrong, but I cannot get the arm to work with the joystick although the left and right motors work just fine. Thanks for your help.

Below is my code:

#pragma config(Motor, port1, rightMotor, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port6, armMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, leftMotor, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main ()
{

while(1 == 1)
{
motor[leftMotor] = vexRT[Ch3]; // Left Joystick Y value
motor[rightMotor] = vexRT[Ch2]; // Right Joystick Y value
}

if (vexRT[Btn6U] ==1)
{
motor[armMotor] = 40;
}

else
{
motor[armMotor] = 0;
}

if (vexRT[Btn6D] == 1)
{
motor[armMotor] = -40;
}

else
{
motor[armMotor] = 0;
}

}

Author:  JohnWatson [ Fri Sep 11, 2015 9:07 am ]
Post subject:  Re: Programming the arm

Take a look at your while loop; what specifically determines which code is executed by the loop, and what code is currently being controlled by the loop? Also, how long is that loop going to keep executing code for? The answers to these questions should help point you in the correct direction.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/