Hi,
My team and I has been trying to code a joystick (Logitech X3D Pro).
What we want to achieve is a motor to run when the trigger is pressed, and not run when the trigger is not pressed.
Here’s what we’ve got so far:
//Right Motors
private final VictorSP rightmotor1 = new VictorSP(0);
private final VictorSP rightmotor2 = new VictorSP(1);
// Left Motors
private final VictorSP leftmotor1 = new VictorSP(2);
private final VictorSP leftmotor2 = new VictorSP(3);
//Shooter
private final VictorSPX shooter1 = new VictorSPX(4);
//Speed Controller Groups
private final SpeedControllerGroup rightSpeedGroup = new SpeedControllerGroup(rightmotor1, rightmotor2);
private final SpeedControllerGroup leftSpeedGroup = new SpeedControllerGroup(leftmotor1, leftmotor2);
//drivetrain
DifferentialDrive drivetrain = new DifferentialDrive(rightSpeedGroup, leftSpeedGroup);
//Joystick
Joystick stick = new Joystick(1);
@Override
public void teleopPeriodic() {
drivetrain.arcadeDrive(stick.getY()^3, stick.getZ()^3);
if (stick.getRawButton(1)==True){
shooter.set(1);
} else {
shooter.set(0);
When I press the trigger button, it does nothing, but when I move foward (arcade drive), the motor goes foward, and when I go reverse, it goes reverse too… Im confused…
My team and I are new to programming (our programming mentor left last year). If anyone has any tutoriasl in either JAVA or Labview on how to program a robot from scratch, please foward it to me
Any help would be appreciated!
Thanks,
Matt