Do not name your spike object and the cannonFire() method the same thing. I'd change the spike name to cannonSpike if I were you but do whatever suits you best. Also, you will need to call that method (cannonFire) from something. But you will need to create a joystick instance to have a button to press. In your Robot.java file, create an instance of a joystick. To do this, add this line after the "public class Robot extends ___" line:
Add this line after the "public Robot()" (constructor) line:
Code:
stick = new Joystick(0); // new joystick on port 0. Change this if you wish
Then, when you press button 5 on the joystick you will want the code to run the method inside the Cannon subsystem. Add the following lines under the operatorControl method:
Code:
if(stick.getRawButton(5) == true){
Cannon.cannonFire();
}
This should get you all set from there in terms of programming. You can remove the Command file if you so desire.