Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   InternalButton based on axis inputs (http://www.chiefdelphi.com/forums/showthread.php?t=119735)

fovea1959 26-09-2013 20:25

InternalButton based on axis inputs
 
I remember seeing a team's nice InternalButton implementation that would take a GenericHID (or Joystick?), an exis specification, and a threshold, and produce a couple of InternalButton objects ; the idea being that commands could be trigger off the joystick (or DPAD) position.

I thought I had it safely squirreled away, but it's not coming up.

Has anyone else seen this? Don't want to write something that's already out in the wild....

Joe Ross 26-09-2013 23:05

Re: InternalButton based on axis inputs
 
Here it is in C++ http://www.chiefdelphi.com/forums/sh...29&postcount=6

BigJ 27-09-2013 10:31

Re: InternalButton based on axis inputs
 
Here's a not-quite-generic version in Java, but could easily be modified to be generic to your needs:

https://github.com/frc1675/frc1675-2...PadButton.java

edit: looking at it again, this is such a short class that "modifying it to your needs" is basically rewriting the class, haha. I also looked at the javadoc for InternalButton, and we didn't use this as one, but I'm pretty sure it could just extend InternalButton instead if you wanted access to setPressed().

fovea1959 28-09-2013 16:16

Re: InternalButton based on axis inputs
 
Thanks!

and the third answer from team 2168,very similar to both the above.

https://gist.github.com/jcorcoran/5743806

comments are not quite right around the description of the constructor, but it's also nice to use.


All times are GMT -5. The time now is 22:35.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi