View Single Post
  #3   Spotlight this post!  
Unread 22-01-2009, 23:23
LinuxMercedes LinuxMercedes is offline
Real men use Macs
FRC #1444 (Lightning Lancers)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: St. Louis, MO
Posts: 22
LinuxMercedes is an unknown quantity at this point
Re: How do I Link a (group of) Joystick button(s) to a motor?

I *think* I see the problem with your code. Basically, it won't hold the value the victor is set at.

It works this way: Say you push button 4. One cycle reads the button:

if(m_rollerStick->GetRawButton(4)) m_rollerCondition = -1;

and since it sees that button 4 is pushed, it sets the victor to -1. Then it cycles through again. But since you're not holding down the button, it won't keep the victor at -1. Instead, it will do your default action:

default:
m_roller->Set(0);
break;

which sets the victor back to 0. So what you should do is set up some code that reads a button state, sets a variable that stays at that value until it detects that a different button is pushed. I'll leave the implementation of that to the reader =]

Let me know if that wasn't clear enough. I'm good at explaining things to myself; it's explaining things to others that's hard =]
__________________
Reply With Quote