Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. /* Copyright (c) 2017 FIRST. All rights reserved.
  2. *
  3. * Redistribution and use in source and binary forms, with or without modification,
  4. * are permitted (subject to the limitations in the disclaimer below) provided that
  5. * the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice, this list
  8. * of conditions and the following disclaimer.
  9. *
  10. * Redistributions in binary form must reproduce the above copyright notice, this
  11. * list of conditions and the following disclaimer in the documentation and/or
  12. * other materials provided with the distribution.
  13. *
  14. * Neither the name of FIRST nor the names of its contributors may be used to endorse or
  15. * promote products derived from this software without specific prior written permission.
  16. *
  17. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
  18. * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  20. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  22. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  24. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  25. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29.  
  30. package org.firstinspires.ftc.teamcode;
  31.  
  32. import com.qualcomm.robotcore.eventloop.opmode.Disabled;
  33. import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
  34. import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
  35. import com.qualcomm.robotcore.hardware.DcMotor;
  36. import com.qualcomm.robotcore.util.ElapsedTime;
  37. import com.qualcomm.robotcore.util.Range;
  38.  
  39.  
  40. /**
  41. * This file contains an minimal example of a Linear "OpMode". An OpMode is a 'program' that runs in either
  42. * the autonomous or the teleop period of an FTC match. The names of OpModes appear on the menu
  43. * of the FTC Driver Station. When an selection is made from the menu, the corresponding OpMode
  44. * class is instantiated on the Robot Controller and executed.
  45. *
  46. * This particular OpMode just executes a basic Tank Drive Teleop for a two wheeled robot
  47. * It includes all the skeletal structure that all linear OpModes contain.
  48. *
  49. * Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
  50. * Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
  51. */
  52.  
  53. @TeleOp(name="Brate", group="Linear Opmode")
  54. //@Disabled
  55. public class Brate extends LinearOpMode {
  56.  
  57. // Declare OpMode members.
  58. private ElapsedTime runtime = new ElapsedTime();
  59. DcMotor MotorPrindere;
  60. double power=0.5;
  61.  
  62. @Override
  63. public void runOpMode() {
  64. telemetry.addData("Status", "Initialized");
  65. telemetry.update();
  66.  
  67. waitForStart();
  68. runtime.reset();
  69. MotorPrindere=hardwareMap.dcMotor.get("Motor_Prindere");
  70. // run until the end of the match (driver presses STOP)
  71. while (opModeIsActive()) {
  72. telemetry.addData("Status", "Run Time: " + runtime.toString());
  73. telemetry.update();
  74.  
  75. if(gamepad2.dpad_right) MotorPrindere.setPower(power);
  76. else MotorPrindere.setPower(0.0);
  77.  
  78. if(gamepad2.dpad_left) MotorPrindere.setPower(-power);
  79. else MotorPrindere.setPower(0.0);
  80.  
  81.  
  82.  
  83.  
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement