BeamBreak#
Documentation for BeamBreakSensor#
BeamBreakSensor Class#
The BeamBreakSensor class represents a digital beam break sensor.
Constructor Parameters:
hw: HardwareMap- The hardware map to initialize the sensor.name: String- The name of the sensor.
Properties:
beamBreak: DigitalChannel- The digital channel representing the beam break sensor.
Methods:
isBroken(): Boolean- Returnstrueif the beam is broken,falseotherwise.telemetry(Telemetry telemetry)- Adds the beam break sensor state to telemetry.
Usage Example#
public class ExampleOpMode extends LinearOpMode {
@Override
public void runOpMode() {
HardwareMap hardwareMap = hardwareMap;
Telemetry telemetry = telemetry;
// Initialize BeamBreakSensor
BeamBreakSensor beamBreakSensor = new BeamBreakSensor(hardwareMap, "beamBreakSensor");
waitForStart();
while (opModeIsActive()) {
// Add telemetry data
beamBreakSensor.isBroken();
beamBreakSensor.telemetry(telemetry);
telemetry.update();
}
}
}