We took all of your suggestions into consideration, and here's our revised code. It's still not building and maybe we were wrong about the syntax error.
Code:
#include <WPILib.h>
#include <Jaguar.h>
#include <Victor.h>
class RobotDemo : public SimpleRobot
{
RobotDemo(void)
{ // put initialization code here
Jaguar leftmotor(1);
Victor rightmotor(2);
Joystick leftjoy(1);
Joystick rightjoy(2);
}
void Autonomous(void)
{ // put autonomous code here
}
void OperatorControl(void)
{ // put operator control code here
update_drive();
}
void update_drive()
{
int k = 1; //speed increase/decrease value
if (leftjoy.GetY() >= (255 - k)) //if left joystick is near max
{ //overshot security
leftmotor.rawset(leftjoy.GetY());
}
if (leftjoy.GetY() <= k) //if left joystick is near min
{ //undershot security
leftmotor.rawset(leftjoy.GetY());
}
if ((leftjoy.GetY() < (255 - k)) && (leftjoy.GetY() > k)) //otherwise...
{ //standard control
if (leftjoy.GetY() > leftmotor.rawget())
{ //speed up
int leftmotortemp1 = leftmotor.rawget();
leftmotor.rawset(leftmotortemp1 + k);
if (leftjoy.GetY() < leftmotor.rawget())
{ //overshot security
leftmotor.rawset(leftjoy.GetY());
}
}
if (leftjoy.GetY() < leftmotor.rawget())
{ //slow down
int leftmotortemp1 = leftmotor.rawget();
leftmotor.rawset(leftmotortemp1 - k);
if (leftjoy.GetY() > leftmotor.rawget())
{ //undershot security
leftmotor.rawset(leftjoy.GetY());
}
}
}
if (rightjoy.GetY() >= (255 - k)) //if right joystick is near max
{ //overshot security
rightmotor.rawset(rightjoy.GetY());
}
if (rightjoy.GetY() <= k) //if right joystick is near min
{ //undershot security
rightmotor.rawset(rightjoy.GetY());
}
if ((rightjoy.GetY() < (255 - k)) && (rightjoy.GetY() > k)) //otherwise...
{ //standard control
if (rightjoy.GetY() > rightmotor.rawget())
{ //speed up
int rightmotortemp1 = rightmotor.rawget();
rightmotor.rawset(rightmotortemp1 + k);
if (rightjoy.GetY() < rightmotor.rawget())
{ //overshot security
rightmotor.rawset(rightjoy.GetY());
}
}
if (rightjoy.GetY() < rightmotor.rawget())
{ //slow down
int rightmotortemp1 = rightmotor.rawget();
rightmotor.rawset(rightmotortemp1 - k);
if (rightjoy.GetY() > rightmotor.rawget())
{ //undershot security
rightmotor.rawset(rightjoy.GetY());
}
}
}
}
};
Start_Robot_Class(RobotDemo);
Edit: The code has been corrected for the most part. Please let us know if you can find any other problems.