# Joystick Wheels

Hey!

Alright, we need another button or something else to accuate another cylinder. Unfortunately, pneumatics have taken up all the buttons and triggers except for the wheels on the joysticks. So basically, the question I have is, if we want to use the wheels, do we change the p1_wheel = p1_wheel MAX 127 in the default code?? How do we even program the wheels on the joystick? We are so confused! Please someone help!

~Jenni~

Unlike the buttons, the wheels are analog controls that will have a value between 0 and 254, with 127 being the middle. Based on the fact that you are going to be controlling relays with them, you only need to know whether the wheel is greater than 127 or less than it. The following code will accomplish this:

relayX_fwd = p1_wheel / 127
relayX_rev = 1 - relayX_fwd

This works because of the way integer math rounds things off. (ie 200/127=1 and 50/127 = 0). The second line is there to make sure that the relay is either in forward or reverse, but not both. If you are using the big Festo single solenoid, you can (and should) get rid of the second line.

With this code, whenever the wheel is at or above the middle, the cylinder will go one way. When it is below, it will go the other. Let me know if you were looking for something different.

â€“Rob

the ammount of buttons available to you on the OI is next to limitless. you will do yourselves and your team a great favor if you use actual buttons on your panel versus the buttons/wheels on the sticks. my teams experience is that the chance of accidentally hitting the joystick buttons is quite high.

the InnovationFIRST website has the pinout of the OI ports and you can very simply connect a button between a input pin and a ground to trigger a variableâ€¦ Example:

port 3:
pin 2 and pin 4 triggers the p3_sw_trig variable to a 1
and a 0 when the pins arent connected.

this is what the pin is aliased to in the default codeâ€¦ yours may be different.

do yoursleves a favor, read the IFI Full size RC users manual, will explain this in detail for you

~Pyro

rbayer~
Thank you so much! Now something actually works, and we can say we actually have something to show for our time today!

Pyrophin~
Iâ€™m really sorry if we wasted your time by asking a question that could easily be found in the manual. We are not very experienced programmers, and the manual makes no sense to us. Therefore, we rely on you guys to help us with what we donâ€™t understand. We really are trying to understand more and try to bother you seasoned programmers as little as possible. Once again, sorry if we inconvenienced you in anyway.

~Jenni~

EniJenni,

Helping is mostly what we are here for, donâ€™t let PyroPhin put you off. I can tell from your team number that you are on a second year team. It really takes at least four to five years for a team to get itâ€™s act together.

Yes, the info you needed was in the manual, but there is often a certain level of expertise needed to realize that the answer to your question is sitting in front of you. You see the answer, you just donâ€™t comprehend it.

Last night I was working in one of our sponsors machine shop. Now Iâ€™ve been around shops for more than twenty five years, but last night I saw something on a table Iâ€™d never seen before. I didnâ€™t know what this strange object was so I asked about it. It was a thread file. You use it to clean up threads cut on a lathe. Just the thing for the job and I could tell by looking that it would work in that application. But until I was told, I had no idea what I was looking at or that it was an elegant solution to a problem.

Unfortunately it was not the problem I was working to solve.

So keep asking questions and someday you too will be giving the answers

im sorryâ€¦

just wanted to apologize if i came off the wrong way, i meant no offense to you and your team. perhaps i could have worded my response a bit better.

the manual is a great sounce of information on the OI and gives you the information you need to pretty much build anything you can think of. if you have any questions on itâ€™s contents or need something explained feel free to Message me, be more than happy to assist you >>: )

AIM - Audiocomputerpri

or just drop me a message on the Chiefdelphi thingie

~Pyro

Ok well questions ARE good, so donâ€™t stop asking themâ€¦ BUT this thread is about extra inputs. We just got through that, so I have some insight that might be usefulâ€¦

I see 4 ways to do what you need to do:

1. The â€śCheapâ€ť way, but you may consider it the best. Ive been doing this for a long time so I would detest my team doing it. Basically you put a second joystick on port 2 and use those buttons.

2. This is a little more difficult. If its just one pneumatic piston, Iâ€™m assuming its on a double solenoid valve. That means you only need one or two buttons, depending on how the programing is written. You could go to radioshack and buy two (or one) NO (normally open) pushbutton switches for less then \$2. If you donâ€™t like buttons you could do the whole thing with one STSP toggle switch (i.e. a â€ś1â€ť is up and a â€ś0â€ť is down"). Then you get a small plastic enclosure for another \$2. A male DB15 connector (for use with cable) or female DB15 connector (no cable) runs for less then a buck. Finally, make sure you have rosin-core solder and a pencil iron (>30W is a GOOD thing). The whole thing will take about 2 hours to assemble with no experience, or about 15 minutes if you know what your doing. The whole apparatus plugs into PORT2.

3. This is similar to solution #2, but a little more complicated. BY SPEC, a standard joystick port has 2 sets of x and y, and 4 buttons. In the (crummy) joysticks that FIRST provides us with, they use X1 and Y1 in the handle, and Y2 on the wheel (might wanna check me on that, Iâ€™m doing this from memory). They use buttons 1 and 2. That leaves open X2, button 3 and button 4 for your use. Theres a couple of problems with this, however. The cable that comes with the stick has only the pins (and wires) that they use, which would mean you would have to put on a new cord. Second, it is not clearly documented how to get to buttons 3 and 4 from the RC code; I think that it is AUX1 and AUX2, but I could be wrong. And finally, you have to be pretty good at taking stuff apart (experience DOES matter) because theres a lot of flimsy stuff in there and is VERY easy to mess up. Well actually I take that back, its a well build joystick, and with the relatively open construction it has been one of the easiest mods Ive ever doneâ€¦

4. This is going to be the fastest, and if you look in the right place, the cheapest. BUY A DIFFERENT JOYSTICK!

Well that sums that up. You probably arenâ€™t going to use #2 or #3 but hopefully someone else will find this thread useful; as I put almost as much work into the descriptions as I did the modsâ€¦ ; )

If anyone has any questions, feel free to email me at [email protected]

thanks, Jacob

*Originally posted by PyroPhin *
**the ammount of buttons available to you on the OI is next to limitless. you will do yourselves and your team a great favor if you use actual buttons on your panel versus the buttons/wheels on the sticks. my teams experience is that the chance of accidentally hitting the joystick buttons is quite high.
~Pyro **

â€¦Which is exactly why we have a saftey programed into the driverâ€™s joystick. In order for the desired action to be perfromed, either the trigger or the top button must be held in and the remaining button can then be pressed. Much like a â€śsafteyâ€ť on a gun.