Open huyle125 opened 8 years ago
2/16/16 Code
package org.usfirst.frc.team5027.robot;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.CameraServer;
public class Robot extends IterativeRobot {//This is where you make variables
RobotDrive Drive;
Joystick JoyOne;
//Motor Controller
Victor FrontLeftMotor;
Victor FrontRightMotor;
Victor BackLeftMotor;
Victor BackRightMotor;
//Pwm Slots
final int PwmOne = 1;
final int PwmTwo = 2;
final int PwmThree = 3;
final int PwmFour = 4;
final int JoyInput = 1;
CameraServer server;
public void robotInit() {//This is where you initialize the variables
FrontLeftMotor = new Victor(PwmOne);
BackLeftMotor = new Victor(PwmTwo);
FrontRightMotor = new Victor(PwmThree);
BackRightMotor = new Victor(PwmFour);
Drive = new RobotDrive(FrontLeftMotor, BackLeftMotor, FrontRightMotor, BackRightMotor);
Drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);
Drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
Drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
Drive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
JoyOne = new Joystick(JoyInput);
server = CameraServer.getInstance();
server.setQuality(50);
server.startAutomaticCapture("cam0");
}
public void autonomousInit() {
}
public void autonomousPeriodic() {//This is where you auto Code Run
}
public void teleopInit(){
}
public void teleopPeriodic() {//This is where your control Code Run.
if (JoyOne.getRawButton(1)){
Drive.arcadeDrive(JoyOne.getY()/2.0, JoyOne.getX()/2.0);
}
else {
Drive.arcadeDrive(JoyOne);
}
}
public void testPeriodic() {//This is where you Test Code Run
}
}