View Single Post
  #2   Spotlight this post!  
Unread 12-02-2008, 17:02
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: two drive styles

A very way to do this is preprocessor directives. Keep arcade set to 1 or 2 and have tank set to 1 and 2 (assuming those are the ports you have your joysticks plugged into). Then at the top of the file, type either

Code:
#define TANK
or

Code:
#defien ARCADE
Then, in your main code, put

Code:
#ifdef TANK
(put your tank code here)
#else
(put your arcade code here)
#endif
When you go to compile, if TANK is #defined, it will use your tank code. If you change #define TANK to #define ARCADE (or anything else for the matter), your arcade code will be used instead. This is done when the code is compiled, not as it is running. Therefore, to change which drive configuration you would like to use, simply change the #define up top.

Our team is using code like this, which I will post here tonight as an example once I get to the meeting
__________________