1. Opening Devices & Joystick Input

Hey Guys,

I know you can use the open command to open files and devices, but I was wondering how you would get a device from the USB port, like if you had a USB joystick, how would you get data from the device and stuff? I know you use the open command, but I'm not sure how to go about it. Any help? Example code would be nice.

new topic     » topic index » view message » categorize

2. Re: Opening Devices & Joystick Input

Andy said...

Hey Guys,

I know you can use the open command to open files and devices, but I was wondering how you would get a device from the USB port, like if you had a USB joystick, how would you get data from the device and stuff? I know you use the open command, but I'm not sure how to go about it. Any help? Example code would be nice.

A look in the archives under "joystick" yields:

http://www.rapideuphoria.com/winjoy.zip

I know I've used a USB joystick in an app, but I don't think it was the above lib that I used; it's possible that there might be a demo from Win32Lib that also lets you use USB joystick, I'm not sure. But give the above a try & see if it lets you do what you want. If not, let us know & I'll look for what I did, don't know where it is right now though.

It is, btw, always a good bet to look first in the archives smile

Dan

new topic     » goto parent     » topic index » view message » categorize

3. Re: Opening Devices & Joystick Input

DanM said...
Andy said...

Hey Guys,

I know you can use the open command to open files and devices, but I was wondering how you would get a device from the USB port, like if you had a USB joystick, how would you get data from the device and stuff? I know you use the open command, but I'm not sure how to go about it. Any help? Example code would be nice.

A look in the archives under "joystick" yields:

http://www.rapideuphoria.com/winjoy.zip

I know I've used a USB joystick in an app, but I don't think it was the above lib that I used; it's possible that there might be a demo from Win32Lib that also lets you use USB joystick, I'm not sure. But give the above a try & see if it lets you do what you want. If not, let us know & I'll look for what I did, don't know where it is right now though.

It is, btw, always a good bet to look first in the archives smile

Dan

Alright, thanks, I'll check it out

new topic     » goto parent     » topic index » view message » categorize

4. Re: Opening Devices & Joystick Input

Turns out the aforementioned lib (or earlier version?) IS what I used, you can get buttons off the joystick too. May have to play with values and methods, tho. One thing I did mention in my app is that the query for available joysticks on system didn't work right on XP system, as follows (with fix):

-- JOYSTICK INPUT STUFF: 
 
include joy.ew 
 
  object void 
 
if joy_init()=0 then 
	puts(1,"No joystick(s) attached!") 
	abort(0) 
end if 
 
-- NOTE: BOTH ABOVE AND THIS DO *NOT* WORK ON XP, SHOWS 1 CONNECTED WHEN NONE IS! 
puts(1, "number of joysticks attached: " & sprint(joy_init()) & "\n") 
 
-- these DO work: 
sequence joy_info,s 
integer button_mask 
 
joy_info = {} 
 
	s = joy_get_state(1) 
 
--DM  THIS MAKES QUIT IF NO JOYSTICK FOUND ON XP SYSTEM. 
      if equal(s, {}) then 
         puts(1, "no joystick connected.\n") 
         puts(1, "press any key to exit; then attach a joystick to a USB port") 
         void= wait_key() 
         abort(0) 
      end if 

I'm pretty sure that the demo with the lib does show more about how to use it.

Dan

new topic     » goto parent     » topic index » view message » categorize

5. Re: Opening Devices & Joystick Input

DanM said...

Turns out the aforementioned lib (or earlier version?) IS what I used, you can get buttons off the joystick too. May have to play with values and methods, tho. One thing I did mention in my app is that the query for available joysticks on system didn't work right on XP system, as follows (with fix):

-- JOYSTICK INPUT STUFF: 
 
include joy.ew 
 
  object void 
 
if joy_init()=0 then 
	puts(1,"No joystick(s) attached!") 
	abort(0) 
end if 
 
-- NOTE: BOTH ABOVE AND THIS DO *NOT* WORK ON XP, SHOWS 1 CONNECTED WHEN NONE IS! 
puts(1, "number of joysticks attached: " & sprint(joy_init()) & "\n") 
 
-- these DO work: 
sequence joy_info,s 
integer button_mask 
 
joy_info = {} 
 
	s = joy_get_state(1) 
 
--DM  THIS MAKES QUIT IF NO JOYSTICK FOUND ON XP SYSTEM. 
      if equal(s, {}) then 
         puts(1, "no joystick connected.\n") 
         puts(1, "press any key to exit; then attach a joystick to a USB port") 
         void= wait_key() 
         abort(0) 
      end if 

I'm pretty sure that the demo with the lib does show more about how to use it.

Dan

Well the joystick library helps. But I was wondering how I'd go about getting input and info from an Xbox360 controller.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Opening Devices & Joystick Input

Andy said...

Well the joystick library helps. But I was wondering how I'd go about getting input and info from an Xbox360 controller.

In order to control a device on the windows operating system;
a device driver for that device must be installed on windows.

I do not think there is a device driver written for windows using
an xbox360 controler.

Unless you write your own or find one written by someone else
your out of luck.

If the device was a serial or parallel device it would be much simpler.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Opening Devices & Joystick Input

Andy said...

Well the joystick library helps. But I was wondering how I'd go about getting input and info from an Xbox360 controller.

Googling Xbox360 controller yields:

http://www.microsoft.com/hardware/gaming/ProductDetails.aspx?pid=091

which suggests that there is a xbox360 controller that will work with both the xbox AND windows computers. Whether this is a different controller than one shipped with xbox, I have no idea.

Here's another Googled link that might be important with regard to drivers and actually using it, but the web site is somewhat hard to read:

http://mattbrett.com/2005/11/configuring-your-xbox-360-controller-for-windows/

Dan

new topic     » goto parent     » topic index » view message » categorize

8. Re: Opening Devices & Joystick Input

DanM said...
Andy said...

Well the joystick library helps. But I was wondering how I'd go about getting input and info from an Xbox360 controller.

Googling Xbox360 controller yields:

http://www.microsoft.com/hardware/gaming/ProductDetails.aspx?pid=091

which suggests that there is a xbox360 controller that will work with both the xbox AND windows computers. Whether this is a different controller than one shipped with xbox, I have no idea.

Here's another Googled link that might be important with regard to drivers and actually using it, but the web site is somewhat hard to read:

http://mattbrett.com/2005/11/configuring-your-xbox-360-controller-for-windows/

Dan

And then there's this too:

http://www.redcl0ud.com/xbcd.html

and:

http://xbcd360guide.50webs.com/

hope that helps, that's all I can do relative to gaming.

Dan

new topic     » goto parent     » topic index » view message » categorize

9. Re: Opening Devices & Joystick Input

DanM said...
DanM said...
Andy said...

Well the joystick library helps. But I was wondering how I'd go about getting input and info from an Xbox360 controller.

Googling Xbox360 controller yields:

http://www.microsoft.com/hardware/gaming/ProductDetails.aspx?pid=091

which suggests that there is a xbox360 controller that will work with both the xbox AND windows computers. Whether this is a different controller than one shipped with xbox, I have no idea.

Here's another Googled link that might be important with regard to drivers and actually using it, but the web site is somewhat hard to read:

http://mattbrett.com/2005/11/configuring-your-xbox-360-controller-for-windows/

Dan

And then there's this too:

http://www.redcl0ud.com/xbcd.html

and:

http://xbcd360guide.50webs.com/

hope that helps, that's all I can do relative to gaming.

Dan

Thanks, I know the 360 controller works on windows, I've already used it with other apps. I'd just like to use it with Euphoria or rather make library in Euphoria to use it with Euphoria.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu