delete comments to make code readable and change message to 'go' to match Arduino
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / Robot.java
index 905844120d2bba3ebfbae9ace7670b060c4b0a83..688c1e6312eb1e954033aa0eea351a0adc9e17c1 100644 (file)
@@ -1,8 +1,7 @@
 package org.usfirst.frc.team3501.robot;
 
 import org.usfirst.frc.team3501.robot.Constants.Defense;
-import org.usfirst.frc.team3501.robot.sensors.GyroLib;
-import org.usfirst.frc.team3501.robot.sensors.Photogate;
+import org.usfirst.frc.team3501.robot.commands.shooter.ResetCatapult;
 import org.usfirst.frc.team3501.robot.subsystems.DefenseArm;
 import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
 import org.usfirst.frc.team3501.robot.subsystems.IntakeArm;
@@ -10,6 +9,7 @@ import org.usfirst.frc.team3501.robot.subsystems.Scaler;
 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
 
 import edu.wpi.first.wpilibj.I2C;
+import edu.wpi.first.wpilibj.I2C.Port;
 import edu.wpi.first.wpilibj.IterativeRobot;
 import edu.wpi.first.wpilibj.command.Scheduler;
 import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
@@ -25,21 +25,17 @@ public class Robot extends IterativeRobot {
   public static IntakeArm intakeArm;
   public static DefenseArm defenseArm;
 
-  public static Photogate photogate;
+  static I2C Wire = new I2C(Port.kOnboard, 42);
 
   // Sendable Choosers send a drop down menu to the Smart Dashboard.
   SendableChooser positionChooser;
   SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense,
       positionFourDefense, positionFiveDefense;
 
-  // Gyro stuff
-  public GyroLib gyro;
-
   @Override
   public void robotInit() {
     driveTrain = new DriveTrain();
     oi = new OI();
-    gyro = new GyroLib(I2C.Port.kOnboard, false);
 
     shooter = new Shooter();
     scaler = new Scaler();
@@ -138,17 +134,20 @@ public class Robot extends IterativeRobot {
 
   @Override
   public void teleopInit() {
-
-    gyro.start();
-
+    Scheduler.getInstance().add(new ResetCatapult()); // Reset catapult at start
+                                                      // of each match.
   }
 
   @Override
   public void teleopPeriodic() {
     Scheduler.getInstance().run();
-
-    System.out.println("Degrees: " + gyro.getRotationZ().getAngle());
-
+    String WriteString = "go";
+    char[] CharArray = WriteString.toCharArray();
+    byte[] WriteData = new byte[CharArray.length];
+    for (int i = 0; i < CharArray.length; i++) {
+      WriteData[i] = (byte) CharArray[i];
+    }
+    Wire.transaction(WriteData, WriteData.length, null, 0);
   }
 
 }