finish photogate insertion
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / intakearm / Photogate.java
index 9e6c2e8b5f1c000c8dd4c6b19c3542d9dbe6cea0..aff5fc2d623a2b2a6ee5a2003f49c34d34e87df8 100644 (file)
@@ -13,6 +13,7 @@ import edu.wpi.first.wpilibj.AnalogInput;
 public class Photogate extends AnalogInput {
 
   private double threshold = 1.8;
+  static boolean ballState;
 
   /***
    * The constructor inputs the channel of the transistor and the threshold
@@ -26,6 +27,7 @@ public class Photogate extends AnalogInput {
   public Photogate() {
     super(0);
     this.threshold = threshold;
+
   }
 
   /***
@@ -33,11 +35,17 @@ public class Photogate extends AnalogInput {
    *         USE TO DECIDE WHEN OUTTAKE NEEDS TO HAPPEN FOR BALL TO BE SECURE
    */
   public boolean isBallPresent() {
-    if (this.getVoltage() > threshold)
+    if (this.getVoltage() > threshold) {
+      ballState = true;
       return true;
-    else
-      return false;
+    } else
+      ballState = false;
+    return false;
+
+  }
 
+  public static boolean ballState() {
+    return ballState;
   }
 
   /***