From 3f40c624a9b60ae984e0693b1939bc5adff77259 Mon Sep 17 00:00:00 2001 From: WilliamKluge Date: Tue, 27 Oct 2015 15:05:24 -0500 Subject: [PATCH] October 27, 2015 Uploading the code for the first time --- .../usfirst/frc/team3926/robot/Robot.class | Bin 0 -> 2537 bytes build.properties | 4 + build.xml | 30 +++++++ src/org/usfirst/frc/team3926/robot/Robot.java | 79 ++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 bin/org/usfirst/frc/team3926/robot/Robot.class create mode 100644 build.properties create mode 100644 build.xml create mode 100644 src/org/usfirst/frc/team3926/robot/Robot.java diff --git a/bin/org/usfirst/frc/team3926/robot/Robot.class b/bin/org/usfirst/frc/team3926/robot/Robot.class new file mode 100644 index 0000000000000000000000000000000000000000..afe09c593bbd4d5a9423db0f97cffa885543236f GIT binary patch literal 2537 zcmc&!U2_vv7=8{(lP2AMKmkDn+Y&Gh&|rb`Q9eo zw~mZ=j#F;D#9JNG&ghIkzzZ+E^auDO7@u=CO<|^SymM!E-{-vhp7;BGe}D1IZvf8X zt1xy6#2j}qS*w;Tx9TNJZXxMOvwY^_@JP~i791~`Q{OOxl$6C-mVEGD%6Ui?I-smo@&pdIu-S~o zbjx|imKDb;3LI}Copx#qw%n4V*`Tepi*&=`Ol74;YrZ#)L%TU{(@9CaVosoap?M5l zwkno)RUi-_oT0LDrzoQc;7tRE@J0jz{RZ}8pF&3s9Kb<^jv06z2L-ybRz*(N$_vuH zW6~{wJz1w<+B2qWsdIxF^p>ou3hBS}i%Pt1p9~!fNK-fp;47B^`ynzTpVO(TkcUHdL2vJmNs^nLsERH)B&vk5D zx}*P#m>>C715tE@G1fA1TRj`aH4Lc~jT5dBJ}|J~Z`uzHyoP;B^uB?QVG0-&&6#Vdnnw$M%glww zxYpF8sx1wau&9T(vaFYZKwCVW9-L9pS_U3~8zE4Y9J64Y>&5Qk!;nLJKpsDT{W=g+t0~W=~kr*;*o(* z6*IVet5g!`%zI{GdCFXA%yBgD)ZBucu+*eS^@t2TFjrMhGnI;T$8ED(m7Mf89U=Nz zi2#$@&6m@t@~dW1Q%<6$oI_37vzoFIHDw!W$|ls5&7~>3LsRY~O<875S!7MQp)}=w zA`Q|5?lFE3^E6Fw1nJ(yCXOV!>gY=Z>KIU;*iYo|!f}50(^qgHg4}iy-tFSuUY_65 zTzwyL4D!T!H+BET$ke|liC=MIHn@pXb)43?P2*vWLmHpeIIQsq@rBvMa}4tx;d`3z z*-c!k;|hOWn+@e9+ zv70cq&I+*clj^X6rDy0Mn(QJZrO_Ue+|RH#;66h?5A>(Ot7%@RFYu5DmB4`Rx@q0l=UAr^ zcHnu|=^|IrCEUU&mT;NFc?B-U@HwvIYozcU()bY**yKw30~!3uTK + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/org/usfirst/frc/team3926/robot/Robot.java b/src/org/usfirst/frc/team3926/robot/Robot.java new file mode 100644 index 0000000..56288fa --- /dev/null +++ b/src/org/usfirst/frc/team3926/robot/Robot.java @@ -0,0 +1,79 @@ + +package org.usfirst.frc.team3926.robot; + +import edu.wpi.first.wpilibj.CANTalon; +import edu.wpi.first.wpilibj.DoubleSolenoid; +import edu.wpi.first.wpilibj.DoubleSolenoid.Value; +import edu.wpi.first.wpilibj.IterativeRobot; +import edu.wpi.first.wpilibj.Joystick; +import edu.wpi.first.wpilibj.RobotDrive; +import edu.wpi.first.wpilibj.Talon; + +public class Robot extends IterativeRobot { + CANTalon talonSRX_FR; //Front Right + CANTalon talonSRX_FL; //Front Left + CANTalon talonSRX_BR; //Back Right + CANTalon talonSRX_BL; //Back Left + RobotDrive driveSystem; + Joystick leftStick; + Joystick rightStick; + Joystick XBox; + Talon talonLift; + DoubleSolenoid armSolenoid; + + double lift = 0; + double leftInput; + double rightInput; + + boolean aClicked = false; + boolean bClicked = false; + + public void robotInit() { + talonSRX_FR = new CANTalon(1); + talonSRX_FL = new CANTalon(2); + talonSRX_BR = new CANTalon(3); + talonSRX_BL = new CANTalon(4); + + driveSystem = new RobotDrive(talonSRX_FL, talonSRX_BL, talonSRX_FR, talonSRX_BR); + + leftStick = new Joystick(0); //USB 0 + rightStick = new Joystick(1); //USB 1 + XBox = new Joystick(2); //USB 2 + + talonLift = new Talon(0); + + armSolenoid = new DoubleSolenoid(5, 7, 6); + } //End robotInit() + + public void autonomousPeriodic() { + + } //End autonomousPeriodic() + + public void teleopPeriodic() { + leftInput = leftStick.getY(); //leftInput = left Y + rightInput = rightStick.getY(); //rightInput = right Y + lift = XBox.getY(); //lift = XBox's main (left) Y axis + + if (XBox.getRawButton(1) && !aClicked) aClicked = true; //If the a button is pressed and it hasn't already been + if (XBox.getRawButton(2) && !bClicked) bClicked = true; //If the b button is pressed and it hasn't already been + if (XBox.getRawButton(4) || (bClicked && aClicked)) { //If the y button is pressed or aClicked and bClicked are true (That's optional) stop cylander + aClicked = false; + bClicked = false; + } + + if (leftStick.getRawButton(1)) { //Saftey mode + leftInput /= 2; + rightInput /= 2; + } + if (rightStick.getRawButton(1)) leftInput = rightInput; //Forward mode + + driveSystem.tankDrive(leftInput, rightInput); + + if (lift != 0) talonLift.set(lift); //Left XBox Y + else talonLift.set(0); + + if (aClicked) armSolenoid.set(DoubleSolenoid.Value.kForward); //A button open + else if (bClicked) armSolenoid.set(DoubleSolenoid.Value.kReverse); //B button close + else armSolenoid.set(DoubleSolenoid.Value.kOff); + } //End teleopPeriodic() +} //End Robot