View Single Post
  #4   Spotlight this post!  
Unread 30-03-2011, 23:40
Dacilndak's Avatar
Dacilndak Dacilndak is offline
Matt'); DROP TABLE Users; --
AKA: Matthew Haney
FRC #3729 (Red Knights)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Denver, Colorado
Posts: 12
Dacilndak is an unknown quantity at this point
Re: Take a quick look at our code?

Quote:
Originally Posted by tux
Code:
if (rstick.GetRawButton(1)){
	armUp.Set(false);
	armDn.Set(true);
} else if (rstick.GetRawButton(2)){
	armUp.Set(true);
	armDn.Set(false);
}
			
if (rstick.GetRawButton(10)){
	miniOut.Set(true);
	miniIn.Set(false);
} else if (rstick.GetRawButton(7)){
	miniOut.Set(false);
	miniIn.Set(true);
}
I would strongly recommend you add the following cases:

Code:
if (rstick.GetRawButton(1)){
	armUp.Set(false);
	armDn.Set(true);
} else if (rstick.GetRawButton(2)){
	armUp.Set(true);
	armDn.Set(false);
} else {
	armUp.Set(false);
	armDown.Set(false);
}
			
if (rstick.GetRawButton(10)){
	miniOut.Set(true);
	miniIn.Set(false);
} else if (rstick.GetRawButton(7)){
	miniOut.Set(false);
	miniIn.Set(true);
} else {
	miniOut.Set(false);
	miniIn.Set(false);
}
As you have it at the moment, if you press, say, button 10 on the joystick, the miniOut solenoid will activate, but will not turn off if you release the button. That's probably not what you would want it to do.
__________________
Team 3729 - Raiders - Programming Team Co-Captain
2011 Colorado Regional Semifinalist
2011 Colorado Regional Rookie All-Star Award
2011 Colorado Regional Highest Rookie Seed Award
Reply With Quote