Thread: button control
View Single Post
  #3   Spotlight this post!  
Unread 06-02-2008, 21:25
Alexa Stott's Avatar
Alexa Stott Alexa Stott is offline
All I do is twin.
AKA: elixir
FRC #0025 (Raider Robotix)
Team Role: College Student
 
Join Date: Oct 2005
Rookie Year: 2006
Location: No. Bruns., NJ/College Park, MD
Posts: 781
Alexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond repute
Send a message via AIM to Alexa Stott
Re: button control

For each port on your OI, you have px_sw_top, px_sw_trig, px_sw_aux1, and px_sw_aux2 with "x" being the appropriate port number. Each of these corresponds with a button or a trigger on whatever joystick is plugged into the port (trig and top being the most obvious).

Your code should look something like this when you program the buttons:
Code:
if(button)
{
     doSomething();
}
...and so on from there.

Remember that buttons are digital devices; they are either on or off (1 or 0, respectively).

To control time, we've always simply defined a static unsigned int to 0 and incremented it for each loop of the processor. It takes a lot of playing around to get the values right. There are other ways to do this, as stated above, but that is one of your options.

Hopefully that helps.
__________________
|Email:alexastott[at]gmail.com|Facebook|@zelixir|Google+|
[University of Maryland Computer Science, Psychology]
[Brunswick Eruption]

Last edited by Alexa Stott : 06-02-2008 at 21:32.