Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Programming Buttons (http://www.chiefdelphi.com/forums/showthread.php?t=146695)

bensen19r 04-04-2016 11:34 PM

Programming Buttons
 
Hello there, I am here to request your help with a specific task with buttons. To start with, our buttons are booleans, and when i find it, I will post how they are declared/used etc. For now though, what I would like help with doing is
When I press a button, no matter how long I hold it, it will run the motor for a selected time.

To be more exact and say exactly what I'm doing, I want it so when our secondary driver presses and holds a button, it will intake the ball all the way(this is already done), then I want him to be able to press a button and have the boulder go down just the right amount(with testing it turned out to be .15 seconds at %80 power). Finally, he will press 1 more button and it will turn on the shooter(s)(Top and Bottom) at 100% power for about 2 seconds then intake the boulder for a short amount of time. What this does in simpler terms is intakes the boulder all the way, puts the boulder down to the right position, then revs up the shooter(s) before intaking the boulder to shoot it.

Agent ZeusChops 04-05-2016 12:18 AM

Re: Programming Buttons
 
Is this with an Xbox Controller or with a Joystick?

As a side-note, if you currently happen to implement the Joystick class from the WPILIBj, there should be a .whileDown for the joystick (or it's .whileHeld but eclipse should help you depict that).

euhlmann 04-05-2016 09:40 AM

Re: Programming Buttons
 
Are you using the command based framework? If so, you can easily make commands for all of these tasks. Just use the setTimeout method in initialize() to set it to run for the amount of time you want, and return isTimedOut() in isFinished.

Then, get JoystickButton objects out of your Joysticks and attach commands to them.

bensen19r 04-05-2016 09:58 AM

Re: Programming Buttons
 
This particular task is being programmed on the Logitech Attack 3 Joystick, I will try the .whileHeld or .whileDown here shortly, thank you for the suggestion!

We are also not using a command based program so it won't be that simple

bensen19r 04-05-2016 10:57 AM

Re: Programming Buttons
 
Quote:

Originally Posted by bensen19r (Post 1567885)
This particular task is being programmed on the Logitech Attack 3 Joystick, I will try the .whileHeld or .whileDown here shortly, thank you for the suggestion!

We are also not using a command based program so it won't be that simple

I was just thinking and the whileHeld thing won't work because I just want it to go off of the first value so right as it's pressed it will take that first value and then run the command, I don't want to have to hold it


All times are GMT -5. The time now is 07:25 AM.

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