This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from rh-robotics/sadie-implementing-sensors
Implementing Sensors
- Loading branch information
Showing
5 changed files
with
43 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 16 additions & 5 deletions
21
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/TouchSensorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
package org.firstinspires.ftc.teamcode.auton; | ||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; | ||
import com.qualcomm.robotcore.eventloop.opmode.OpMode; | ||
import com.qualcomm.robotcore.hardware.TouchSensor; | ||
|
||
import org.firstinspires.ftc.teamcode.subsystems.hardware.Hardware; | ||
import org.firstinspires.ftc.teamcode.subsystems.hardware.HardwareElement; | ||
|
||
@Autonomous(name="Touch Sensor Test") | ||
|
||
public class TouchSensorTest extends OpMode { | ||
TouchSensor touch; | ||
private Hardware robot; | ||
boolean pressed; | ||
|
||
@Override | ||
public void init() {} | ||
public void init() { | ||
telemetry.addData("Touch Sensor", "Initializing"); | ||
robot = new Hardware(hardwareMap, telemetry); | ||
robot.introduce(new HardwareElement<>(TouchSensor.class, hardwareMap, "touchSensor")); | ||
telemetry.addData("Touch Sensor", "Initialized"); | ||
} | ||
|
||
@Override | ||
public void loop() { | ||
touch = hardwareMap.touchSensor.get("touchSensor"); | ||
telemetry.addData("Touch Sensor", touch.isPressed()); | ||
pressed = robot.<TouchSensor>get("touchSensor").isPressed(); | ||
telemetry.addData("Touch Sensor Pressed", pressed); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters