
17-02-2015, 15:57
|
|
Registered User
 FRC #4284
|
|
Join Date: Jan 2015
Location: Cincinnati,Ohio
Posts: 20
|
|
|
Re: Robot Code Problem ** Again**
Quote:
Originally Posted by GeeTwo
Declaring objects inside a method makes them local objects that (unless copied elsewhere) disappear when the method returns. I'm presuming you want these to be instance variables. In this case, declare them earlier and just assign them in robotInit():
Code:
public class Robot extends IterativeRobot {
RobotDrive Drive;
Joystick drivestick;
Joystick joystick;
Jaguar FL, BL, FR, BR;
int autoLoopCounter;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
FL = new Jaguar (5);
BL = new Jaguar (2);
FR = new Jaguar (3);
BR = new Jaguar (4);
Drive = new RobotDrive(FL,BL,FR,BR);
drivestick = new Joystick(0);
joystick = new Joystick(1);
}
P.S.: Also, enclosing your code with the tags makes it easier to read!
P.P.S.: After seeing this, I did not review the rest of the code.
|
The robot drive works, that is not the problem that I am running into I cannot get the buttons to work.
|