View Single Post
  #5   Spotlight this post!  
Unread 14-02-2009, 17:26
Rick Wagner's Avatar
Rick Wagner Rick Wagner is offline
Registered User
FRC #3008 (Kalani Robotics)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Honolulu, Hawaii
Posts: 188
Rick Wagner is a splendid one to beholdRick Wagner is a splendid one to beholdRick Wagner is a splendid one to beholdRick Wagner is a splendid one to beholdRick Wagner is a splendid one to beholdRick Wagner is a splendid one to beholdRick Wagner is a splendid one to behold
Re: Using Integer variables

Quote:
Originally Posted by programmr View Post
yes, where to put the variable seems to be our problem. we want to use the variable to keep track of the state of one of our joystick buttons in teleop mode.

int x;
//Now later in the program during teleop routines
if (rightStick->GetRawButton(2)) {
if x = 1 {
x=0; }

else {
x=1; }

x could then be examined to determine the speed of our motors.
I think you want to be saying

Code:
if (x == 1) { ...
rather than the single equal sign, which is an assignment operator, not a conditional.