Button Class VP
SIPI Robotics
Posts: 4
Is there a reason why the button class was not implemented as a VP? It seems poorly designed and it took me much time and finally looking at the button.java code to understand·button.getstate() won't work without calling button.buttonDown() continuously. This seems like its much better suited for a VP.
Further confusion comes from the manual documentation not agreeing with the sample code (which does agree with the button class).
Another poorly documented/ implemented (?) feature is the debounceDelay. Its hardcoded to 0 in the class definition·yet there are no calls for it. Is it a global variable that can overwrite the default value?
Is it possible to write other VP's in java, and if so how difficult would it be? Is there information online to get started writing java VP's?
Thanks,
SIPI Robotics Team
Further confusion comes from the manual documentation not agreeing with the sample code (which does agree with the button class).
Another poorly documented/ implemented (?) feature is the debounceDelay. Its hardcoded to 0 in the class definition·yet there are no calls for it. Is it a global variable that can overwrite the default value?
Is it possible to write other VP's in java, and if so how difficult would it be? Is there information online to get started writing java VP's?
Thanks,
SIPI Robotics Team
Comments
http://forums.parallax.com/showthread.php?p=558075
debounceDelay is a public variable, meaning your Button instance may
set it to any value.
Note that although Button is not a VP, it may use up a VP slot
due to a declared Timer object (it takes a VP slot if this is the first Timer object)
You may consider the attached programs for checking a pin.
No Timer object is used and the codesize is significantly smaller.
You can not write your own VP. The way demonstrated in the
attachements or by using the Timer object for concurrent operation
is the only possibility.
regards peter
Post Edited (Peter Verkaik) : 3/23/2006 11:48:03 PM GMT