View Single Post
  #1   Spotlight this post!  
Unread 02-21-2016, 10:00 AM
CyberTeam5713 CyberTeam5713 is offline
Registered User
FRC #5713
 
Join Date: Feb 2016
Location: Michigan
Posts: 25
CyberTeam5713 is an unknown quantity at this point
Please Help ME !!!!!!!

We are programming our intake we got the intake to bring the ball in but we cant seem to get it to work to shoot it back out Here is the code.


Teleop Code

public void teleopPeriodic() {
while (isOperatorControl() && isEnabled()) {
Fulldrive.setSafetyEnabled(true);
Fulldrive.arcadeDrive(Drivestick);

if(controlStick.getRawButton(3)) {
IntakeBall.ShootBall(0.5);
}
else if(!controlStick.getRawButton(3)) {
IntakeBall.ShootBall(0.0);
}
if(controlStick.getRawButton(2)) { // Takes Ball
IntakeBall.GrabBall(0.5);
}
else if(!controlStick.getRawButton(2)) {
IntakeBall.GrabBall(0.0);
} Timer.delay(0.01); } }


I made a class for the intake/ shooter


import edu.wpi.first.wpilibj.Talon;

public class IntakeBall {

private Talon leftWheel, rightWheel;

public IntakeBall(Talon leftWheel, Talon rightWheel) {

this.leftWheel = leftWheel;
this.rightWheel = rightWheel;
}



public void GrabBall(double speed) { // Gets Ball in

leftWheel.set(-speed);
rightWheel.set(speed);
}

public void ShootBall(double speed) {
leftWheel.set(speed);
rightWheel.set(speed);
rightWheel.setInverted(true);
} }
Reply With Quote