Hello everyone,
I am working on a the code for a VEX robot, using RobotC for Cortex. I have never used C, C++ let alone robotc (Java is my primary language). So far, I am having a tough time understanding how to write the code for our robot.
I’ll give you a description of what it is and what I’d like it to do. It is a 4 wheeled robot with an arm controllable by 1 servo (We only had 5 motors and the arm was the only part that only had to move a certain degree). There is an intake that has 1 motor to control it.
So, the tl;dr version is 4 motors for driving, 1 servo to move the arm and 1 motor to do intake.
What I want to do is do tank drive on the 4 motors, have the two triggers (Equivalent to R1 and L1 on PS3) move the arm up and down, and have the “A” button turn on the intake.
I havn’t been able to get much past the template. I have the 4 motor tank drive working, but that’s it.
#pragma config(Motor, port2, frontRightMotor, tmotorServoContinuousRotation, openLoop, reversed)
#pragma config(Motor, port3, backRightMotor, tmotorServoContinuousRotation, openLoop, reversed)
#pragma config(Motor, port4, frontLeftMotor, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port5, backLeftMotor, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port6, armServo, tmotorServoStandard, openLoop)
task main()
{
while(1 == 1)
{
//Right side of the robot is controlled by the right joystick, Y-axis
motor[frontRightMotor] = vexRT[Ch2];
motor[backRightMotor] = vexRT[Ch2];
//Left side of the robot is controlled by the left joystick, Y-axis
motor[frontLeftMotor] = vexRT[Ch3];
motor[backLeftMotor] = vexRT[Ch3];
//Servo?
//Intake?
}
}
I can answer any questions that might help you understand what I’m trying to do. Need this to be done this week (5 days) and I don’t have enough time in the day to learn a lot of the syntax. All help is appreciated.
Thanks!
Joel