:):):):):):):):):):):):)
This commit is contained in:
robotics1
2024-03-14 15:46:41 -07:00
parent a27996882b
commit 05cc0c6785

View File

@ -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();
}
}
}