Instantiate hall effect sensor inside runFlyWheel() method
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / shooter / RunFlyWheel.java
index 203f9dce79a4eb3088eb1155e9e67dfa1fbac036..3900b57122ed5bbf0f1e604b6a33fe015f572e06 100644 (file)
@@ -1,7 +1,9 @@
 package org.usfirst.frc.team3501.robot.commands.shooter;
 
 import org.usfirst.frc.team3501.robot.Robot;
+import org.usfirst.frc.team3501.robot.subsystems.HallEffectSensor;
 
+import edu.wpi.first.wpilibj.Counter;
 import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Command;
 
@@ -13,8 +15,12 @@ import edu.wpi.first.wpilibj.command.Command;
  */
 public class RunFlyWheel extends Command {
   Timer timer;
+  HallEffectSensor hallSource;
+  Counter hall;
   private double motorVal;
   private double time;
+  private int bufferLength = 15;
+  private int hallChannel = 0; // hallChannel=DIO channeL
 
   /**
    * See JavaDoc comment in class for details
@@ -30,6 +36,11 @@ public class RunFlyWheel extends Command {
     timer = new Timer();
     this.motorVal = motorVal;
     this.time = time;
+
+    hall = new Counter(hallChannel);
+    hall.setMaxPeriod(1);
+
+    hallSource = new HallEffectSensor(hall, bufferLength);
   }
 
   // Called just before this Command runs the first time
@@ -42,6 +53,8 @@ public class RunFlyWheel extends Command {
   // Called repeatedly when this Command is scheduled to run
   @Override
   protected void execute() {
+    double rotVel = hallSource.getRPS();
+
   }
 
   // Called once after isFinished returns true