Go to Post You should take in to consideration who you are putting on to the field, not what. - NorviewsVeteran [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 03-30-2011, 11:40 PM
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
 


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 10:03 AM.

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