View Single Post
  #1   Spotlight this post!  
Unread 01-15-2013, 01:37 PM
Bennett Bennett is offline
Registered User
FRC #2977 (Sir Lancer Bots)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Minnesota
Posts: 26
Bennett is an unknown quantity at this point
Relay/Spike Problems?

I have some code to turn on a spike that is connected to a compressor, and I can turn it on but not off, so I made a second button running a command to turn it off. Problem is, when I added the second command, nothing happens. If I comment it out, It works fine.
Code:
public class OI {
    
    Joystick Joystick = new Joystick(1); //Xbox 360 Controller.
    Button button1 = new JoystickButton(Joystick,1);
   // Button button2 = new JoystickButton(Joystick,4);
    public OI(){
        button1.whenPressed(new SpikeOn()); //Runs command to turn it on.
      //  button2.whenPressed(new SpikeOff()); //Runs command to turn it off.
    }
^^ Works Fine


Code:
public class OI {
    
    Joystick Joystick = new Joystick(1); //Xbox 360 Controller.
    Button button1 = new JoystickButton(Joystick,1);
    Button button2 = new JoystickButton(Joystick,4);
    public OI(){
        button1.whenPressed(new SpikeOn()); //Runs command to turn it on.
        button2.whenPressed(new SpikeOff()); //Runs command to turn it off.
    }
^^ It won't do anything
Any Ideas?
Reply With Quote