View Single Post
  #7   Spotlight this post!  
Unread 21-03-2012, 12:57
Team1605 Team1605 is offline
Registered User
FRC #1605
 
Join Date: Feb 2012
Location: toronto
Posts: 30
Team1605 is an unknown quantity at this point
Re: Need Serious help !!!!

Code:
/*----------------------------------------------------------------------------*/
/* 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.Joystick.AxisType;
import edu.wpi.first.wpilibj.*;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the SimpleRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class Team1605 extends SimpleRobot {
    
    
    Joystick stickDriverLeft = new Joystick(1);
    Joystick stickDriverRight = new Joystick(2);
    
    
    Jaguar leftMotor = new Jaguar(2);
    Jaguar rightMotor = new Jaguar(1);
    Jaguar shooterMotor1 = new Jaguar(3);
    Jaguar shooterMotor2 = new Jaguar(4);
    Jaguar gatherMotor1 = new Jaguar(5);
    Jaguar gatherMotor2 = new Jaguar (6);
    
    RobotDrive robotDrive = new RobotDrive(leftMotor,rightMotor);
    Shooter shooter = new Shooter(shooterMotor1,shooterMotor2);
    Gatherer gatherer = new Gatherer(gatherMotor1, gatherMotor2);
    
    final int TRIGGER_NUMBER = 1;
    final int GATHER_START_BUTTON = 2;
    final int GATHER_STOP_BUTTON = 3;
    
    
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    public void autonomous() {
        
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void OperatorControl() {
        while(isOperatorControl() && isEnabled())
    {
        
        robotDrive.tankDrive(stickDriverLeft.getAxis(AxisType.kY), stickDriverRight.getAxis(AxisType.kY));
        
        
        if(stickDriverRight.getRawButton(TRIGGER_NUMBER)) {
           shooter.set(1);
        }
        else {
            shooter.set(0);
        }
        
        
        if(stickDriverRight.getRawButton(GATHER_START_BUTTON)) {
            gatherer.set(1);
        }
        else if(stickDriverRight.getRawButton(GATHER_STOP_BUTTON)) {
            gatherer.set(0);
        }
        Timer.delay(.01);
    }

    }
}
that is the code the problem is now that it works but only one wheel will spin and none of the buttons will work
Reply With Quote