SHARE
TWEET

Untitled

a guest Nov 22nd, 2016 11 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package org.firstinspires.ftc.teamcode;
  2.  
  3. import com.qualcomm.robotcore.hardware.ColorSensor;
  4. import com.qualcomm.robotcore.hardware.DcMotor;
  5. import com.qualcomm.robotcore.hardware.HardwareMap;
  6. import com.qualcomm.robotcore.hardware.Servo;
  7.  
  8.  
  9. /**
  10.  * Created by User on 10/24/2016.
  11.  */
  12.  
  13. public class RobotHardware {
  14.     /* Declare OpMode members. */
  15.     DcMotor driveLeft       = null;
  16.     DcMotor driveRight      = null;
  17.  
  18.     DcMotor linearSlide     = null;
  19.  
  20.     DcMotor shooterLaunch   = null;
  21.     DcMotor shooterIntake   = null;
  22.  
  23.     Servo   buttonPush      = null;
  24.  
  25.     ColorSensor colorSensor = null;
  26.  
  27.  
  28.     //public static final double buttonPush_MIN_RANGE = 0;
  29.     //public static final double buttonPush_MAX_RANGE = 1;
  30.  
  31.     public double buttonPushPosition;
  32.     public double buttonPushDelta;
  33.  
  34.     HardwareMap hwMap           =  null;
  35.  
  36.     public RobotHardware() {
  37.  
  38.     }
  39.  
  40.     public void init(HardwareMap ahwMap) {
  41.         hwMap = ahwMap;
  42.  
  43.         driveRight = hwMap.dcMotor.get("motor_1");
  44.         driveLeft = hwMap.dcMotor.get("motor_0");
  45.         driveRight.setDirection(DcMotor.Direction.FORWARD);
  46.         driveLeft.setDirection(DcMotor.Direction.REVERSE);
  47.  
  48.         linearSlide = hwMap.dcMotor.get("motor_2");
  49.  
  50.         shooterLaunch = hwMap.dcMotor.get("motor_4");
  51.         shooterIntake = hwMap.dcMotor.get("motor_5");
  52.  
  53.         colorSensor = hwMap.colorSensor.get("color_0");
  54.  
  55.  
  56.         driveRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
  57.         driveLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
  58.  
  59.         linearSlide.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
  60.  
  61.         shooterLaunch.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
  62.         shooterIntake.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
  63.  
  64.  
  65.         driveRight.setPower(0);
  66.         driveLeft.setPower(0);
  67.         linearSlide.setPower(0);
  68.         shooterLaunch.setPower(0);
  69.         shooterIntake.setPower(0);
  70.  
  71.  
  72.         buttonPush = hwMap.servo.get("servo_0");
  73.         buttonPush.setPosition(0);
  74.     }
  75. }
RAW Paste Data
Top