Go to Post Sometimes when complaining poverty, we don't recognize the riches we have. - GaryVoshol [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
  #1   Spotlight this post!  
Unread 29-01-2016, 14:31
Sky Captain's Avatar
Sky Captain Sky Captain is offline
Lead Software Mentor
AKA: Will
FRC #0386 (Voltage)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2006
Location: Virginia
Posts: 20
Sky Captain is an unknown quantity at this point
Send a message via AIM to Sky Captain
Joystick Pneumatic Triggering

Hi all,

We're working on a method that when we hit a button on the joystick, we want 2 pneumatic cylinders to fire forward and stay forward until we hit the same button again at which point the cylinders will retract. So far however all we get is the cylinders to fire once and not retract. I'm sure we're pretty close, but just missing something small. We're using a boolean to make sure that we don't try to fire forward if they are already forward. Are we using everything correctly? Here's our pseudo code. All of this code is in the teleop periodic method.
Code:
boolean status = false;

if(joystick.getRawButton(3))
{
     if(status == false)
     {  
           solenoid.kforward();
           status = true;
     }
     else
     {
           solenoid.kreverse();
           status = false;
     }
}
__________________
When in doubt, check the documentation.

Last edited by Sky Captain : 29-01-2016 at 20:01. Reason: Fixing code formatting
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 00:34.

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