From 05cc0c6785b0abf0935e800697961546fb06a17d Mon Sep 17 00:00:00 2001 From: robotics1 Date: Thu, 14 Mar 2024 15:46:41 -0700 Subject: [PATCH] :) :):):):):):):):):):):):) --- .../org/firstinspires/ftc/teamcode/Name.java | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Name.java diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Name.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Name.java new file mode 100644 index 0000000..8a97aa2 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Name.java @@ -0,0 +1,81 @@ +package org.firstinspires.ftc.teamcode; + +import static java.lang.Math.round; + +import com.qualcomm.robotcore.eventloop.opmode.Autonomous; +import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import com.qualcomm.robotcore.hardware.AnalogSensor; +import com.qualcomm.robotcore.hardware.ColorSensor; +import com.qualcomm.robotcore.hardware.DcMotor; +import com.qualcomm.robotcore.hardware.DcMotorSimple; +import com.qualcomm.robotcore.hardware.DistanceSensor; +import com.qualcomm.robotcore.hardware.TouchSensor; + +import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; + +@Autonomous(name="Name") +public class Name extends LinearOpMode { + private DcMotor rightHandWheel; + private DcMotor rightLegWheel; + private DcMotor leftHandWheel; + private DcMotor leftLegWheel; + private TouchSensor iFeelYou; + private DistanceSensor whereAreYou; + private ; + @Override + public void runOpMode() throws InterruptedException { + + rightHandWheel = hardwareMap.get(DcMotor.class,"right hand wheel"); + rightLegWheel = hardwareMap.get(DcMotor.class,"right leg wheel"); + leftHandWheel = hardwareMap.get(DcMotor.class, "left hand wheel"); + leftLegWheel = hardwareMap.get(DcMotor.class, "left leg wheel"); + iFeelYou = hardwareMap.get(TouchSensor.class, "i feel you"); + whereAreYou = hardwareMap.get(DistanceSensor.class , "where are you"); + + rightHandWheel.setDirection(DcMotor.Direction.REVERSE); + rightLegWheel.setDirection(DcMotor.Direction.FORWARD); + leftHandWheel.setDirection(DcMotorSimple.Direction.FORWARD); + leftLegWheel.setDirection(DcMotorSimple.Direction.REVERSE); + + + // Wait for the game to start (driver presses PLAY) + waitForStart(); + + while(opModeIsActive()){ + + /* telemetry.speak( "Oh see, you see" + + "By the dusk's late light" + + "What so proudly we rained" + + "At the twilight's last gleaming?" + + "Whose broad stripes and dark stars" + + "Through the perilous fight" + + "Under the ramparts we watched" + + "Were so gallantly, no, streaming?" + + "And the rockets' red glare" + + "The bombs contracting in air" + + "Gave proof through the night" + + "That our flag was not there" + + "O say, that star-spangled banner doesn't wave" + + "Over the land of the enslaved and the home of the cowardly");*/ + + rightHandWheel.setPower(0.2); + rightLegWheel.setPower(0.2); + leftLegWheel.setPower(0.2); + leftHandWheel.setPower(0.2); + + if(iFeelYou.isPressed()) { + telemetry.speak("Ouchie that hurt me and my feelings"); + telemetry.addData("was i triggered", iFeelYou.isPressed()); + } + + double nicerValue = whereAreYou.getDistance(DistanceUnit.INCH); + + telemetry.addData("you are this far (in inches) --> ", "%.2f", nicerValue); + + telemetry.update(); + } + + } + +}