View Single Post
  #4   Spotlight this post!  
Unread 13-02-2009, 19:59
Redneck's Avatar
Redneck Redneck is offline
Hacker Hick
AKA: Jamie (2.0) Moran
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Aug 2004
Rookie Year: 2004
Location: California
Posts: 90
Redneck is just really niceRedneck is just really niceRedneck is just really niceRedneck is just really nice
Send a message via AIM to Redneck
Re: Inputs on Driver Station

Sure. In your code, you'll need to have something like this:

Code:
class MyRobot : public SimpleRobot{
    
    // Member variables (DigitalInputs, Joysticks, Jaguars, etc)
    DriverStation *ds;

    // Default constructor
    MyRobot(){
         // Initializations for all your other variables
         ds = DriverStation::GetInstance();

    }


    void OperatorControl(){
         float a_variable; 
  
         while ( IsOperatorControl() ){
               OtherFunctionCalls();
               a_variable = ds->GetAnalogIn(1); // returns value of whatever's connected to analog input 1 of the DS
 
               if(ds->GetDigitalIn(2)) { // checks state of DS digital input 2
                    DoSomething();
               }
               else{
                    DoSomethingElse();
               }
         }
    }


};
Does that clear things up a bit?

It'll be slightly different if you're using the IterativeRobot template instead of SimpleRobot, but the Driver Station function calls are the same.
__________________


Which badges can you claim?
Reply With Quote