View Single Post
  #4   Spotlight this post!  
Unread 08-06-2013, 23:48
cad321 cad321 is online now
Jack of all trades, Master of none
AKA: Brian Wagg
FRC #2386 (Trojans)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Burlington, Ontario
Posts: 319
cad321 is just really nicecad321 is just really nicecad321 is just really nicecad321 is just really nice
Re: commands activated by trigger, how?

Some of the code that I have tried thus far is:

Code:
//code trial 1
Trigger DT1 = new Joystick.getTrigger(DriveStick);

//code trial 2
package edu.wpi.first.Command_Learner;


import edu.wpi.first.wpilibj.Joystick;

public class OI {
    Joystick DriveStick = new Joystick(1);
    Joystick SecondaryStick = new Joystick(2);
    
    public OI(){
        if(DriveStick.getTrigger()){
            LauncherSpinWheels();
        }
        else{
            LauncherStopWheels();
        }
}
        
        
    }
//code trial 3
package edu.wpi.first.Command_Learner;


import edu.wpi.first.Command_Learner.commands.LauncherSpinWheels;
import edu.wpi.first.wpilibj.Joystick;


public class OI {
    Joystick DriveStick = new Joystick(1);
    Joystick SecondaryStick = new Joystick(2);

    public boolean ST1;
    
    public OI(){
        ST1 = DriveStick.getTrigger();
        if(ST1=true){
            new LauncherSpinWheels();}
I have been working on this more tonight and think I have gotten close in my 3rd trial of code(seen above). The only issue I am having is that the line with the command "LauncherSpinWheels." In netbeans it underlines in yellow indicating an error and says "New Instance ignored." If you need more in terms of my code please just let me know.

As for the Joystick, I am trying to get the trigger off of an attack 3 Logitech joystick(so it's a Boolean trigger).

Last edited by cad321 : 08-06-2013 at 23:50.
Reply With Quote