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
*/
public class Photogate extends AnalogInput {
- private double threshold;
+ private double threshold = 1.8;
/***
* The constructor inputs the channel of the transistor and the threshold
* @return whether the ball is present or not
*/
public boolean isBallPresent() {
- if (this.getValue() > threshold)
+ if (this.getVoltage() > threshold)
return true;
else
return false;
/***
* @param threshold
- * (range [0, 4095]
+ * (range [0, 4095])
*/
public void setThreshold(int threshold) {
this.threshold = threshold;