|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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); } } } |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|