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

First VEX Robot
http://robotc.net/forums/viewtopic.php?f=15&t=10373
Page 1 of 1

Author:  spermwhales [ Tue Jan 27, 2015 10:29 pm ]
Post subject:  First VEX Robot

Hello everyone! My name is Israel Cobell and I go to a engineering school. We just started a new project involving the VEX robotics kits and my role in the group is the programmer, yet I will still be helping build the robot. I am making the code so our robot is remote controlled, but it seems to have some bugs within it. If any experienced programmers here could debug my code, that would be great. Also, if there are any other errors that could interfere with my intended purpose that would also be great. Here is the code I am working on so far to work with the VEXnet joystick:

#pragma config(Motor, port3, LeftMotor, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port6, RightMotor, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{
while(1 == 1)
{
motor[RightMotor] = vexRT[Ch2] / 2;
motor[LeftMotor] = vexRT[Ch3] / 2;

if(vexRT[Ch2] == 1)

motor[RightMotor] = 127; //* Moves Right Motor forward when right joystick is forward *//

if(vexRT[Ch2] == -1)

motor[RightMotor] = -127; //* Moves Right Motor backward when right joystick is backward *//


if(vexRT[Ch3] == 1)

motor[LeftMotor] = 127; //* Moves Left Motor forward when left joystick is forward *//

if(vexRT[Ch3] == -1)

motor[LeftMotor] = -127; //* Moves Left Motor backward when left joystick is backward *//
}


}



I hope you can understand the intended purpose with the comments I added to each part so please fix them if it is wrong. This is my first time programming with this program and I would appreciate all the help! :D

I will be posting updates and pictures as the robot progresses. Thanks!

Author:  BurningLights [ Wed Jan 28, 2015 12:32 pm ]
Post subject:  Re: First VEX Robot

I believe for what you're trying to do, you just need the first two lines in your while (1 == 1) loop, namely
Code:
motor[RightMotor] = vexRT[Ch2] / 2;
motor[LeftMotor] = vexRT[Ch3] / 2;

All the stuff below that doesn't really do anything for you...

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