Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- /*----------------------------------------------------------------------------*/
- /* Copyright (c) FIRST 2008. All Rights Reserved. */
- /* Open Source Software - may be modified and shared by FRC teams. The code */
- /* must be accompanied by the FIRST BSD license file in the root directory of */
- /* the project. */
- /*----------------------------------------------------------------------------*/
- package edu.wpi.first.wpilibj.templates;
- import edu.wpi.first.wpilibj.SimpleRobot;
- import edu.wpi.first.wpilibj.Jaguar;
- import edu.wpi.first.wpilibj.Victor;
- import edu.wpi.first.wpilibj.Joystick;
- import edu.wpi.first.wpilibj.Timer;
- import edu.wpi.first.wpilibj.RobotDrive;
- public class BotCode extends SimpleRobot
- {
- RobotDrive drive = new RobotDrive(1,2);
- Jaguar fireLeft = new Jaguar(3);
- Jaguar fireRight = new Jaguar(4);
- //Victor ballSucker = new Victor(5);
- Victor ballFlap = new Victor(6);
- Joystick leftStick = new Joystick(1);
- Joystick rightStick = new Joystick(2);
- double FIRE_SPEED = 0.0;
- public BotCode()
- {
- drive.setSafetyEnabled(false);
- }
- public void autonomous()
- {
- /*Kinect Code currently in 988KinectTester. Copy it from there later. That means you, future me.*/
- }
- public void operatorControl()
- {
- while (isOperatorControl() && isEnabled())
- {
- tankDrive(leftStick,rightStick);
- if (rightStick.getRawButton(1)) fusRohDah();
- if (leftStick.getRawButton(1)) dahRohFus();
- if (leftStick.getRawButton(2)) ballSucker.set(.50);
- if (leftStick.getRawButton(3)) ballSucker.set(-.50);
- if (rightStick.getRawButton(8)) ballFlap.set(.50);
- if (rightStick.getRawButton(6)) ballFlap.set(-.50);
- if (rightStick.getRawButton(7)) ballFlap.set(0);
- if (rightStick.getRawButton(3)) FIRE_SPEED += 0.001;
- if (rightStick.getRawButton(2)) FIRE_SPEED += -0.001;
- if (rightStick.getRawButton(10)) ballSucker.set(-.50);
- if (rightStick.getRawButton(11)) ballSucker.set(0);
- if (rightStick.getRawButton(9)) ballSucker.set(.50);
- Timer.delay(0.005);
- }
- }
- public void fusRohDah()
- {
- fireRight.set(-FIRE_SPEED);
- fireLeft.set(FIRE_SPEED);
- }
- public void dahRohFus()
- {
- fireRight.set(0);
- fireLeft.set(0);
- }
- public void tankDrive(Joystick leftStick, Joystick rightStick) {
- if (leftStick == null || rightStick == null) {
- throw new NullPointerException("Null HID provided");
- }
- drive.tankDrive(leftStick.getY(), -rightStick.getY());
- }
- }
RAW Paste Data

