View Single Post
  #1   Spotlight this post!  
Unread 11-02-2014, 21:45
aweso_meme aweso_meme is offline
Registered User
FRC #4687
 
Join Date: Feb 2014
Location: Minnesota
Posts: 20
aweso_meme is an unknown quantity at this point
Exclamation Rookie Java FRC programming buttons

Hello all,

I have run into some trouble while attempting to hook up pneumatics to the robot. This is my first time programming for FRC, and the first time my team is developing code. I will paste my code below, but first a description of the problem. The robot does drive. All wires are hooked up to where they should be. However, whenever I pull the trigger on the joystick (Logitech Attack 3), the code does not perform. A solenoid is supposed to trigger rapidly on and off, but the solenoid does not trigger on and off in practice. I am using the basic layout for my code.
Without further ado, here is my code (I do my brackets differently than most):

package edu.wpi.first.wpilibj.templates;
//import statements

public class RobotCode extends simpleRobot {

private RobotDrive drivetrain;
private Joystick driveStick;
Solenoid solenoid;
Trigger jButton;
int j = 0; // standard int which will be used in a for loop.

public void initMethod()
{
// Initialization code goes here
drivetrain = new RobotDrive(1,2,3,4);
driveStick = new Joystick(1);
solenoid = new Solenoid(1);
}
public void autonomous() { }


public void operatorControl()
{
while (true && isOperatorControl() && isEnabled())
{
drivetrain.arcadeDrive(driveStick);
Timer.delay(0.001);
if (driveStick.getTrigger() == true)
{
for (j=0 ; j<3 ; j++)
{
solenoid.set(true);
Timer.delay(0.1);
solenoid.set(false);
Timer.delay(0.1);
} //End For Loop
} // End if Statement
} // End While Statement
} // End Method


public void test() { }
}//END CODE

Thank you for your help. For your reference, I have coded in Java before and am currently in AP Computer Science.
Reply With Quote