From 6d21fb6c05b2d994e777672c2254e60fed18ef6e Mon Sep 17 00:00:00 2001 From: KevinAGonzalez Date: Mon, 17 Jun 2024 15:23:02 -0500 Subject: [PATCH] Hello World script to ftc robot from textbook. --- .../ftc/teamcode/MyFIRSTJavaOpMode.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/MyFIRSTJavaOpMode.java diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/MyFIRSTJavaOpMode.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/MyFIRSTJavaOpMode.java new file mode 100644 index 000000000000..e25566e35f03 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/MyFIRSTJavaOpMode.java @@ -0,0 +1,41 @@ +package org.firstinspires.ftc.teamcode; + +import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import com.qualcomm.robotcore.hardware.DcMotor; +import com.qualcomm.robotcore.hardware.DigitalChannel; +import com.qualcomm.robotcore.hardware.DistanceSensor; +import com.qualcomm.robotcore.hardware.Gyroscope; +import com.qualcomm.robotcore.hardware.Servo; + +@TeleOp + +public class MyFIRSTJavaOpMode extends LinearOpMode { + private Gyroscope imu; + private DcMotor motorTest; + private DigitalChannel digitalTouch; + private DistanceSensor sensorColorRange; + private Servo servoTest; + + + @Override + public void runOpMode() { + imu = hardwareMap.get(Gyroscope.class, "imu"); + motorTest = hardwareMap.get(DcMotor.class, "motorTest"); + digitalTouch = hardwareMap.get(DigitalChannel.class, "digitalTouch"); + sensorColorRange = hardwareMap.get(DistanceSensor.class, "sensorColorRange"); + servoTest = hardwareMap.get(Servo.class, "servoTest"); + + telemetry.addData("Status", "Initialized"); + telemetry.update(); + // Wait for the game to start (driver presses PLAY) + waitForStart(); + + // run until the end of the match (driver presses STOP) + while (opModeIsActive()) { + telemetry.addData("Status", "Running"); + telemetry.update(); + + } + } +}