Skip to content

Instantly share code, notes, and snippets.

@joeybeninghove
Created April 23, 2024 23:02
Show Gist options
  • Save joeybeninghove/4f8854ac105c4269a64cc26ee608fa26 to your computer and use it in GitHub Desktop.
Save joeybeninghove/4f8854ac105c4269a64cc26ee608fa26 to your computer and use it in GitHub Desktop.
SillyDemo
/* Copyright Lydia & M1
Take it, I don't care
Programming is just copying
*/
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;
@TeleOp
public class SillyDemo extends OpMode {
private DcMotor slowmotor = null;
private DcMotor fastmotor = null;
private Servo servo;
private double motorspeed;
@Override
public void init() {
fastmotor = hardwareMap.get(DcMotor.class, "motor00");
slowmotor = hardwareMap.get(DcMotor.class, "motor01");
servo = hardwareMap.get(Servo.class, "servo" );
motorspeed = 0.7;
}
@Override
public void start() {
}
@Override
public void loop() {
//Run and top the motors
if (gamepad1.b) {
slowmotor.setPower(0.2);
} else {
slowmotor.setPower(0);
}
if (gamepad1.x) {
fastmotor.setPower(-0.2);
}
if (gamepad1.y){
fastmotor.setPower(0);
}
//Set position on the servo to 3 different spots
if (gamepad1.dpad_left) {
servo.setPosition(0.0);
}
if (gamepad1.dpad_up) {
servo.setPosition(0.5);
}
if (gamepad1.dpad_right) {
servo.setPosition(1.0);
}
}
@Override
public void stop() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment