Thread: Java coding
View Single Post
  #1   Spotlight this post!  
Unread 28-02-2012, 22:04
Team1605 Team1605 is offline
Registered User
FRC #1605
 
Join Date: Feb 2012
Location: toronto
Posts: 30
Team1605 is an unknown quantity at this point
Java coding

/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.Joystick.AxisType;
import edu.wpi.first.wpilibj.*;

/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class RobotTemplate extends SimpleRobot {



Joystick stickDriverLeft = new Joystick(1);
Joystick stickDriverRight = new Joystick(2);
Joystick trigger = new Joystick (3);
Joystick button = new Joystick (4);

Jaguar leftMotor = new Jaguar(2);
Jaguar rightMotor = new Jaguar(1);
Jaguar shootermotor1 = new Jaguar(3);
Jaguar shootermotor2 = new Jaguar(4);
Jaguar gathermotor1 = new Jaguar (5);
Jaguar gathermotor2 = new Jaguar(6);

RobotDrive robotDrive = new RobotDrive(leftMotor, rightMotor);
Shooter TRIGGER_BUTTON = new Shooter(shootermotor1, shootermotor2);
Gatherer gatherer = new Gatherer(gathermotor1, gathermotor2);

final int buttonTriggerNumber = 1;
final int gatherstartbuttonnumber = 2;
final int gatherstopbuttonnumber = 3;

/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
Timer.delay(1);
}

/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
robotDrive.tankDrive(stickDriverLeft.getAxis(AxisT ype.kY), stickDriverRight.getAxis(AxisType.kY));


if (trigger.getRawButton(buttonTriggerNumber)){
TRIGGER_BUTTON.set(1);
}
else {
TRIGGER_BUTTON.set(0);
}


if (button.getRawButton(gatherstartbuttonnumber)) {
gatherer.set(1);

}

if(button.getRawButton(gatherstopbuttonnumber)) {
gatherer.set(0);
}


}
}

Last edited by Team1605 : 28-02-2012 at 22:24.