Go to Post It's not all about the offensive "powerhouses", strategy is key. - smurfgirl [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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
  #5   Spotlight this post!  
Unread 18-02-2012, 18:28
jesusrambo jesusrambo is offline
Self-Proclaimed Programmer Messiah
AKA: JD Russo
FRC #2035 (Robo Rockin' Bots)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Carmel, CA
Posts: 114
jesusrambo is an unknown quantity at this point
Re: Need some quick advice

in OI:

Code:
JoystickButton doStuff = new JoystickButton(joysticknumber, buttonnumber);

doStuff.whenReleased(new Shoot());
Make a command called Shoot
Code:
package edu.wpi.first.wpilibj.templates.commands;

/**
 *
 * @author Thundrio
 */
public class ExampleCommand extends CommandBase {
Timer t = new Timer();


    protected void initialize() {
        shooterMotors.set(1);
        t.reset();
        t.start();
    }

    protected void execute() {
        shooterMotors.set(1);
        if (t.get() >= 1)
            solenoid.extend();
    }

    protected boolean isFinished() {
        if (solenoid.isExtended())
            return true;
        else
            return false;
    }

    protected void end() {
        shooterMotors.set(0);
    }
}
Something like that. Replace the placeholder stuff with your own commands and subsystems obviously, and add a constructor and all.
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 09:15.

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