Advertisement
zealeus

Untitled

Dec 11th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. package org.firstinspires.ftc.teamcode.subClasses;
  2.  
  3. import com.qualcomm.robotcore.hardware.DcMotor;
  4. import com.qualcomm.robotcore.hardware.DcMotorSimple;
  5.  
  6. import static java.lang.Thread.sleep;
  7.  
  8. /**
  9.  * Created by _ on 10/16/17.
  10.  */
  11.  
  12. public class glyphLift {
  13.  
  14.     public DcMotor glyphLift;
  15.     private double autRaisePower = 1.0;
  16.     private int autRaiseTime = 800;
  17.     private int autLowerTime = 300;
  18.     int position;
  19.  
  20.     public glyphLift(DcMotor gL) {
  21.         glyphLift = gL;
  22.  
  23.         glyphLift.setDirection(DcMotor.Direction.REVERSE);
  24.         glyphLift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
  25.         glyphLift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
  26.         glyphLift.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
  27.     }
  28.  
  29.     public void setPower(double power) {
  30.         glyphLift.setPower(power);
  31.     }
  32.  
  33.     public int getCurrentPosition() {
  34.         position = glyphLift.getCurrentPosition();
  35.         return position;
  36.     }
  37.  
  38.     public void raiseGlyphLiftAutMode () throws InterruptedException {
  39.         glyphLift.setPower(autRaisePower);
  40.         sleep(autRaiseTime);
  41.         glyphLift.setPower(0);
  42.     }
  43.  
  44.     public void lowerGlyphLiftAutMode () throws InterruptedException {
  45.         glyphLift.setPower(-autRaisePower);
  46.         sleep(autLowerTime);
  47.         glyphLift.setPower(0);
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement