View Single Post
  #2   Spotlight this post!  
Unread 17-02-2013, 00:36
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 157
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Limit Switch Problems

I'm not a pro at reading robotbuilder code, but in just taking a cursory glance at your loader subsystem file, I see the following code...
Code:
bool Loader::GetReadySwitch(){
	readySwitch->Get();
}
bool Loader::GetEndSwitch(){
	endSwitch->Get();
}
While I didn't study the way these functions are used, it would seem that they are not doing you any good... GetReadySwitch() and GetEndSwitch() should *return* a boolean. They are not returning anything. They each go and 'Get()' the value of the digital inputs, but they don't return them... a corrected version might be:

Code:
bool Loader::GetReadySwitch(){
	return readySwitch->Get();
}
bool Loader::GetEndSwitch(){
	return endSwitch->Get();
}
Without returning anything, whomever calls those Get*Switch() functions won't get any info back.

Also, please look at your compiler warnings. The compiler should warn you that you have defined a function as a 'bool' but you returned no value at all. Warnings from compilers are often times very important - especially when you're less experienced.

bob
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote