![]() |
Programming joysticks
On the new joysticks, there is a mini - milt-direction "d-pad" i guess you could call it. How do you prgram this, or can you even. I can't find it anywhere in the code
|
Re: Programming joysticks
Quote:
|
Re: Programming joysticks
well, the count of buttons on thejoistick does not equal the count of buttons in the program. and it is the odd man out.
|
Re: Programming joysticks
The joystick's POV hat takes the place of the "pN_wheel", where N is the number of the joystick port you're using. I can only really speak for the joystick which I have right in front of me (the other is at my house, being used to play TIE Fighter :)), so YMMV. The two least significant bits of the value change too erratically to be of any use. Here's a listing of the values of the variable when the POV hat is in different positions:
Neutral: 001011xx Up Left: 111111xx Up: 111111xx Up Right: 111111xx Left: 011000xx Right: 110010xx Down Left: 101001xx Down: 100101xx Down Right: 110101xx The x's take the place of the two least significant bits, which, as I said earlier, change randomly (at least with this single joystick). Basically, if you can understand binary, you can take advantage of the POV hat for controlling your robot. Hope this helps. |
Re: Programming joysticks
I have two basic questions. First, can those old robot interfaces be programed for C or are they strictly the old stuff?
Second, does anyone have an old program with just the two joystick controls? All we want to do is hook up an old interface to a mock control board so we can make sure the trannys work. (Note: Im the fabricator, the only thing i know about computers is how to break one) Hopefully i can relay this answer to one of our more knowledgeable people. Thanks |
Re: Programming joysticks
Quote:
|
Re: Programming joysticks
Quote:
|
Re: Programming joysticks
Quote:
If you need any more assistance, feel free to ask. |
Re: Programming joysticks
So the bit masks are:
Code:
const unsigned char Hat_None = 0x2C; |
Programming joysticks
I have a question, how could I add the right lines of code to make the POV hats work with the new C language this year? Amonst other things, where would I have to define them and map them to the right IO ports to work with the hex/bin input signal?
|
Re: Programming joysticks
Quote:
|
Re: Programming joysticks
Quote:
|
Re: Programming joysticks
Quote:
Code:
if( (p1_wheel & 0xC0) == 0xC0 ) |
Re: Programming joysticks
Thanks, that helped a lot. I am just starting out with C so i'm still a little sketchy with it.
|
Re: Programming joysticks
no prob. if you want a review on the syntax of C, you could try the various guides in the whitepapers section, or the guide that I'm working on (see the thread in this forum titled "FIRST Programming Tutorial")
|
| All times are GMT -5. The time now is 20:14. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi