Go to Post Needless to say, lots of smoke came out, and I debated using its terrible smell as a deterrent. - Snapshot [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 05:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi