Go to Post Don't give up on others. I believe in killing grumps with a smile! - maltz1881 [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 10-02-2015, 08:48
nguobadia nguobadia is offline
Registered User
FRC #5608
 
Join Date: Feb 2015
Location: United States
Posts: 1
nguobadia is an unknown quantity at this point
Toggling Buttons

Hi from team 5608! So I'm trying to figure out how to toggle the buttons on our joysticks so that we can turn on and off our solenoids. I keep trying to do it, but they keep conflicting with each other so the pistons either twitch or nothing happens.
So just some background: we have 4 solenoids and 2 joysticks, one joystick for every two solenoids, however Button 3 (raw button) on both joysticks are used to activate their respective solenoids.
Here's our code (I'll give you just one of them since the code would be almost identical for the other one):

/**Toggles the right joystick button 3.*/
public void rightToggle(){

if (right.getRawButton(3)){
if(!isPressedPiston1){
switchSol1 = !switchSol1;

}else {
isPressedPiston1 = !isPressedPiston1;

}
if (switchSol1){
sol1.set(true);
sol2.set(true);

}else {
sol1.set(false);
sol2.set(false);

}

}

}
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 10:52.

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