USB

BlitzMax Forums/BlitzMax Programming/USB

MattVonFat(Posted 2005) [#1]
Is it possible to communicate with a USB device in Blitz?

I'm starting to look at electronics for fun and wanted to make something simple like something that beeps when a key is pressed.

(Also a quick question for anyone who may have done something like this, would a driver need to be made for it to work?)

Thanks
Matt


FlameDuck(Posted 2005) [#2]
Is it possible to communicate with a USB device in Blitz?
Not directly, no.

(Also a quick question for anyone who may have done something like this, would a driver need to be made for it to work?)
Probably. Unless your device can work with one of the standard drivers supplied with your OS of choice.


BlitzSupport(Posted 2005) [#3]
You'd be best looking at something like Nigel Brown's SerialIO module...

http://www.nigelibrown.pwp.blueyonder.co.uk/blitz/index.html


FlameDuck(Posted 2005) [#4]
You'd be best looking at something like Nigel Brown's SerialIO module...
Except that won't work with USB ports, only RS232C type serial ports.


Vertex(Posted 2005) [#5]
http://vertex.art-fx.org/GBA-Net.zip (sorry, bad code)

Communication between BMax and GBA Flashlinker.

You need a usb driver. This driver you open with CreateFile command(winapi, you get a handle of this driver). Now, you must know, what functions this driver support. This functions have a "IOControlCode".

You must use to communicate with this driver the DeviceIOControl function. You hand out the IOControlCode. You request goes to in-pointer, the answer will go in out-pointer. Request size as in-size, answer size as out-size. (Is like CallDLL in BlitzBASIC)

I don't know, if a usb driver support file streams like writef readf.

At the end, you must close the driver with CloseHandle.

cu olli


poet(Posted 2006) [#6]
Vertex, could you please repost your code. I need to interface with an USB device and a working example would be real nice to have. I have the required hardware to do so ;)