FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How To Control Solenoids With Buttons

Hello, the programmers in our team are struggling to program the Solenoids used for the control of the pneumatics with the use of joystick buttons. We have researched plenty about Solenoids and how to program joystick buttons but have not yet found a solution to our problem. It would be greatly appreciated if some one could show us some sample code or more information about this subject.

0 Kudos
Message 1 of 5
(4,518 Views)

Assuming you are using LabVIEW go to

Help menu and select Find Examples...

Navigate to FRC Robotics -> Pneumatics -> Simple Solenoid.lvprojsolinoid example.PNG

The example shows you how to connect and activate a solinoid using the PCM.

sol ex.PNG

The Voltage of your solinoid matters so make sure the correct the VSOL jumper is set for the voltage of your solinod.

This should help you figure out if your wiring is correct if you still need help putting this into your robot main let us know.

Mark

0 Kudos
Message 2 of 5
(3,910 Views)

Thank you but our team already knew how to use the solenoids. What we need to know how to do is how to control the solenoids with the use of joystick buttons. Ex. (Pressing "A" on the joystick sends pressure from the compressor to the cylinders)

0 Kudos
Message 3 of 5
(3,910 Views)

Ok Here is the basics on programming using the joysticks

First plug in you game controller and open you Driver station and select the USB symbol.

You should see your game controller highlighted and the axes, buttons and POV controls available for that controller.

Press the button you want to use and figure out what button number it is

Button 0 is the top left and it numerates going down Button1,2,3....

00_DS buttons.png

Next open the Teleop vi in your Robot Main

01_TeleOP.png

Next select Index Array from the LabVIEW array pallet and place it on the block diagram of the teleop vi

02_Index Array.png

Wire the button array (Thick Green Wire) to the top left terminal of the index array.vi

Then wire a numeric constant to the lower left terminal of the index array.vi

Type the number of the button inside the constant.

The index array will extract the specified button value out of the joystick button array and the output is the desired button value

This value can then be wired into the set vi for the solenoid

03_Set Solinoid.png

Hope this is what you need

If not please give us more details about your issue and post screen shots or attach code so we can better help you

Mark

0 Kudos
Message 4 of 5
(3,910 Views)

We finally figured out how to control the solenoid but instead did it by using an array to cluster function and worked fairly well. Thank you so much for your help!

0 Kudos
Message 5 of 5
(3,910 Views)