View Single Post
  #2   Spotlight this post!  
Unread 09-02-2007, 18:06
Imajie Imajie is offline
Registered User
AKA: James Letendre
FRC #0195 (Cyber Knights)
Team Role: Electrical
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Southington
Posts: 114
Imajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud of
Send a message via AIM to Imajie
Re: WE NEED PGRM HELP

What you need to do is go into the Operator control function, and from the program flow tab on the left side drag a while loop into the function and put a 1 in the box that comes up this will cause the program to loop until the bot is turned off.
Then drag an if block from the same place and drag it inside the while loop, in the box that comes up type
Code:
GetOIDInput([the port you want], [the button number]) == 1
To see what each button number is from the input tab drag OI Digital Input block and the box that comes up will show you what each one is.
What this does is looks if the button is pressed if it is it returns a 1 if not it returns a 0, and the == 1 part looks to see if it is a 1, if it is the code in the if statement will execute otherwise it will skip it, so put whatever you want to have happen when that button is pressed in the if statement.


Here is an example of what the if statement would look like. This one checks if the second joystick trigger is pressed and if it is allows the joysticks to drive the motors.
Code:
        //Check if user drive
        if(GetOIDInput(2, 1)==1)
        {
            Joystick_Drive();
        }
I'm done rambling now
Hope this helps
__________________
2007 UTC Champions Thanks 1124 and 558
2007 UTC GM Industrial Design Award

2006 Newton Divisional Winners
2006 Championship finalists
(Thanks 25 and 968 for picking us!)
2006 National Innovation in Control

Last edited by Imajie : 09-02-2007 at 18:11. Reason: added example