-
Notifications
You must be signed in to change notification settings - Fork 2
/
TestMotorEpp.java
70 lines (63 loc) · 2.65 KB
/
TestMotorEpp.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* ***************************************************************************************
* Copyright (c) 2021 Edward C. Epp. All rights reserved.
*
* Ed C. Epp 9-2021
* Test Motors
*
* This program has two goals:
* Test to determine whether the robot setup and programming support motors
* Illustrate how to write a complete robot program
*
* The following actions are demostrated
* Display the program in the driver station's available autonomous program's list
* Group the program with other "Concept" programs
* Start the program when INIT is pressed
* Tell the user it is ready and wait for the user to press start (right arrow)
* Configure the two motors when start is pressed
* Run the motors at 50% power nntil
* 30 seconds have passed or
* the user presses stop
* Unpower the motors
* Shutdown the program
*
* The goal of this program is to get you started. It does not attempt to explain ever
* word and semicolon. You can learn those details along with how all the mechanics
* of getting the programming loaded into the robot in other tutorials. This program can
* be used as a starting point and modified to do more interesting actions.
*
* 10/2022: Cosmetic edits
*
******************************************************************************************/
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.hardware.DcMotor;
//import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.DcMotorEx;
import com.qualcomm.robotcore.hardware.HardwareMap;
@Autonomous (name = "Epp motor test", group= "Concept")
// @Disabled
public class TestMotorEpp extends LinearOpMode
{
@Override
public void runOpMode ()
{
// initialize the robot and wait for the user to press start
telemetry.addData(">", " To start press play");
telemetry.update();
waitForStart();
// fire up the motors to turn forward at 50%
DcMotor myLeftMotor = hardwareMap.get(DcMotorEx.class, "myLeftMotor");
DcMotor myRightMotor = hardwareMap.get(DcMotorEx.class, "myRightMotor");
myLeftMotor.setPower(0.5);
myRightMotor.setPower(0.5);
// Let the motors run for 30 seconds or until stop pressed
while (opModeIsActive())
{
}
// Shut everything down
myLeftMotor.setPower(0);
myRightMotor.setPower(0);
}
}