Trying to program joystick buttons

Hi this is Rookie Team 3883.

I am trying to program a double solenoid to either a) two different buttons, for extend / retract or B) program it so if I push the button, say to extend an actuator, an accidental press of the button in rapid sucesion wont cause it to retract… i.e. … trying to prevent a false double triggering of the solenoid.

Our lift arm folds like a back hoe… don’t want to refold it, and also looking at control of the manipulator claw actuator.

We’ll learn LabView, but it’s kickin our buts right now.


I don’t know how good at programming you all are, but here’s some basic tips to consider that don’t require any knowledge of labview.

If you want to do something with your code, draw out what you want the program to do (make requirements). Be specific. For example, in your A case, what do you want it to do if both buttons are pressed? If neither is pressed? If the arm is already out, what does the out button do? That example has 8 different states, and you should write down what you want the program to do in each one. Actually, you have 8 control states but you also need to program when to stop the arm. Think about your sensors, and what you want them to do when the arm is going either in or out or is already in or out.

For your B problem, I don’t see why you need that code at all. If the extend button doesn’t do anything when the arm is already out, why should it matter if the arm is already out? Anyway, unless you’re talking about switch debouncing (the “bouncing” that occurs when a physical button is pressed that makes contact on and off really fast before the button is all the way on), you should probably just train your drivers to not press the button if the arm is already out. If you don’t want to do that, just go ahead and make very specific requirements of what you want your code to do.

When you’re done with that, you need to do the actual programming. Since you have all those cases, I’d say start with a case structure or two. An easy way to make one case structure out of a bunch of boolean values is to use the build array function. Expand it, put all your booleans into it, and then use the boolean array to number function to make a number that you feed into the case structure. That lets you have different numbers for all the way the buttons and arm-movements could react (ie in case 7, the first three booleans are pressed and none of the others - binary computation.)

Another good-programming technique is to only have one function where you call the actuator. This means all of the case strctures should output a TRUE or a FALSE depending on which solonoid should be pressed, and then have the solonoid set wired up to that.

Thanks for the info. We are new to Labview. We became a team on Jan 15. Most of it doesn’t make sense yet, but we are learning each day.

I suggest you go to it is a great resource for learning LabVIEW

As of right now we have our buttons set up to momentary. What we want it to do is latch so that when you hit one button the cylinder will shoot out and when we hit the same button it will retract. So basically what I am asking is how do you set that up programming wise.

NI provided an example of this. Check out :

Program Files >> National Instruments >> LabVIEW 8.6 >> examples >> FRC >> Driver Station Inputs >> Joystick Button Latching >> Joystick Button

Please reconsider that decision. “Toggle” functions are not hard to do (in LabVIEW, C++, or any language), but they are rarely good driver interface design.