Go to Post If I had a mul-let then I'd look like Andy Baker used to and that would be ba-ad, really ba-ad. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 27-01-2007, 18:04
billdar billdar is offline
Registered User
FRC #2085
 
Join Date: Jan 2007
Location: california
Posts: 3
billdar is an unknown quantity at this point
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
  #2   Spotlight this post!  
Unread 27-01-2007, 19:43
divergentdave divergentdave is offline
Registered User
FRC #1816 (Green Machine)
 
Join Date: Jun 2006
Rookie Year: 2007
Location: MN
Posts: 35
divergentdave is a jewel in the roughdivergentdave is a jewel in the roughdivergentdave is a jewel in the rough
Send a message via AIM to divergentdave
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)
__________________
Team 1816 - The Green Machine
  #3   Spotlight this post!  
Unread 27-01-2007, 22:43
billdar billdar is offline
Registered User
FRC #2085
 
Join Date: Jan 2007
Location: california
Posts: 3
billdar is an unknown quantity at this point
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
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Direct Drive Issues roberthan Motors 16 21-09-2006 09:33
Direct control of a Servo or Speed Controller Schmitty! National Instruments LabVIEW and Data Acquisition 3 06-03-2006 13:53
Direct Control of PWMs and OI in WPILib CyberWolf_22 Programming 7 06-02-2006 19:06
pic: 1097 Direct Drive 01 Anthony Kesich Robot Showcase 16 13-09-2005 22:33
Direct drive or Chain? Suneet Technical Discussion 32 27-03-2003 23:00


All times are GMT -5. The time now is 10:45.

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