public class Photogate extends AnalogInput {
private double threshold = 1.8;
+ static boolean ballState;
/***
* The constructor inputs the channel of the transistor and the threshold
public Photogate() {
super(0);
this.threshold = threshold;
+
}
/***
* 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;
}
/***