![]() |
Direct Joystick Access
I'm familiar with the OIToRelay, OIToPWM, and the OIToDOutput functions,
but is there a way to read the state of the joystick pushbuttons directly? (ie, something like GetTriggerButton()) Basically I'm trying to do some additional logic between when a button is pressed and when a control action is performed. Also, a side note. I had to move a couple function prototypes and defines (but not everything) from API.h into the file I'm calling them from in MPLAB. I saw an earlier post on this concerning EasyC, but the solution didn't seem to exactly apply. Thanks in advance. -Bill Team 2085 |
Re: Direct Joystick Access
Coincidentally, I was struggling with these same problems mere hours ago.
Last things first, you need to define the preprocessor macro _FRC_BOARD via Project->Build Options->Project->C18 tab->Add macro definition. This is because most of the definitions in API.h are inside #ifdefs that check whether it should include VEX or FRC versions of all the functions. As for the joystick buttons, I believe the function is named GetOIDInput for the buttons and GetOIAInput for joystick axes, so for the trigger button on joystick 1, you would call GetOIDInput(PORT_1, TRIGGER_SW). (disclaimer: this is off the top of my head, I don't have the code in front of me) |
Re: Direct Joystick Access
Right on, exactly what I needed. I saw the ifdefs, figured something
behind the scenes set it based on project processor. Thanks for the heads up on that function. -Bill |
| All times are GMT -5. The time now is 17:31. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi