Go to Post Well, the cake could either be a simple cake Or It is blue, so that obviously means that we are having a water game this year. - big1boom [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2012, 15:29
DiedandLived DiedandLived is offline
Registered User
FRC #3236
 
Join Date: Jan 2012
Location: Tri-County RVTHS
Posts: 3
DiedandLived is an unknown quantity at this point
Declaring Second Joystick

I have had issues attempting to make certain code only apply to the joystick in port 2, however it merely puts all the code into the first joystick. Any suggestions would be great!
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2012, 15:57
DiedandLived DiedandLived is offline
Registered User
FRC #3236
 
Join Date: Jan 2012
Location: Tri-County RVTHS
Posts: 3
DiedandLived is an unknown quantity at this point
Re: Declaring Second Joystick

Basically how do we declare a second joystick in C++.
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2012, 15:59
mikets's Avatar
mikets mikets is online now
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Declaring Second Joystick

Code:
class MyRobot: public SimpleRobot
{
    Joystick stick1;
    Joystick stick2;
 
    MyRobot(): stick1(1),
               stick2(2)
    {
    }
    ...
    void OperatorControl()
    {
        if (stick1.GetRawButton(1))
        {
        }
        else if (stick2.GetRawButton(1))
        {
        }
    }
};
__________________

Last edited by mikets : 10-02-2012 at 16:04.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2012, 18:25
Supernovapsy Supernovapsy is offline
Registered User
FRC #1334
 
Join Date: Feb 2012
Location: Canada
Posts: 18
Supernovapsy is an unknown quantity at this point
Re: Declaring Second Joystick

Yeah, different numbers should be assigned to the joysticks.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 14:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi