Recode everything for new robot
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / sensors / Photogate.java
index ddb5247217eb9ec27e43d3acd2d530300d3e6ad4..c9f3d642fdabf1a74af6caee467d918ae3518aef 100644 (file)
@@ -2,9 +2,6 @@ package org.usfirst.frc.team3501.robot.sensors;
 
 import edu.wpi.first.wpilibj.AnalogInput;
 
-// TODO: Change certain reactions based on testing, ie what value(s) return true
-// and what value(s) return false.
-
 /***
  * The photogate is a pair of IR LED and phototransistor sensor that uses a
  * reflective method to sense the presence of the boulder within the robot's
@@ -15,7 +12,7 @@ import edu.wpi.first.wpilibj.AnalogInput;
  */
 public class Photogate extends AnalogInput {
 
-  private double threshold;
+  private double threshold = 1.8;
 
   /***
    * The constructor inputs the channel of the transistor and the threshold
@@ -35,7 +32,7 @@ public class Photogate extends AnalogInput {
    * @return whether the ball is present or not
    */
   public boolean isBallPresent() {
-    if (this.getValue() > threshold)
+    if (this.getVoltage() > threshold)
       return true;
     else
       return false;
@@ -44,7 +41,7 @@ public class Photogate extends AnalogInput {
 
   /***
    * @param threshold
-   *          (range [0, 4095]
+   *          (range [0, 4095])
    */
   public void setThreshold(int threshold) {
     this.threshold = threshold;