Hello,
Here is a very specific question. I don't know if anyone at this forum is familiar with Phidget interface boards.
In trying to connect my application with Phidgets electronics (sensors, controls, etc.) for an interactive mixed media installation.
I've done it before with Macromedia Director but for Director was a ready-to-use plugin (xtra) available.
Now I'm writing an interface with the Phidget21.dll.
I made a little progress, in a sence that I can make a connection with an interface board (Phidget I/O card) but I get an "Unhandled Exception: Unhandled Memory Exception Error." I learned from this forum that it has to do something with a wrong parameter definition.
Anyway, is there somebody out there who has experience with using Phidgets in BlitzMax and is he/she willing to help me writing an Phidget interface?
Here is my experiment code:
More info and dll downloads at www.phidgets.com
Here is a very specific question. I don't know if anyone at this forum is familiar with Phidget interface boards.
In trying to connect my application with Phidgets electronics (sensors, controls, etc.) for an interactive mixed media installation.
I've done it before with Macromedia Director but for Director was a ready-to-use plugin (xtra) available.
Now I'm writing an interface with the Phidget21.dll.
I made a little progress, in a sence that I can make a connection with an interface board (Phidget I/O card) but I get an "Unhandled Exception: Unhandled Memory Exception Error." I learned from this forum that it has to do something with a wrong parameter definition.
Anyway, is there somebody out there who has experience with using Phidgets in BlitzMax and is he/she willing to help me writing an Phidget interface?
Here is my experiment code:
SuperStrict 'Import pub.win32 Global PhidgetGetSerialNumber:Int(phidgetHandle:Int, serialNumber:Int Var) "C" Global PhidgetOpen:Int(phidgetHandle:Int, serialNumber:Int) "C" Global PhidgetClose:Int(phidgetHandle:Int) "C" Global PhidgetDelete:Int(phidgetHandle:Int) "C" Global PhidgetInterfaceKitCreate:Int(phidgetHandle:Int Var) "C" Global PhidgetWaitForAttachment:Int(phidgetHandle:Int, duration:Long) "C" Global PhidgetSetOnAttachHandler:Int(phidgetHandle:Int, handler:Int(), userDataStruct:Int()) "C" Global PhidgetSetOnDetachHandler:Int(phidgetHandle:Int, handler:Int(), userDataStruct:Int()) "C" 'Global PhidgetInterfaceKitSetOnSensorChangeHandler:Int(phidhetHandle:int, handler:Int(), userDataStruct:Int()) "C" Global ThisDLL:Int = LoadLibraryA("c:\Program Files\Phidgets21\Phidget21.dll") If ThisDLL = Null Then Print "Oops, no dll init" End Else PhidgetGetSerialNumber = GetProcAddress(ThisDLL, "CPhidget_getSerialNumber") PhidgetOpen = GetProcAddress(ThisDLL, "CPhidget_open") PhidgetClose = GetProcAddress(ThisDLL, "CPhidget_close") PhidgetDelete = GetProcAddress(ThisDLL, "CPhidget_delete") PhidgetInterfaceKitCreate = GetProcAddress(ThisDLL, "CPhidgetInterfaceKit_create") PhidgetWaitForAttachment = GetProcAddress(ThisDLL, "CPhidget_waitForAttachment") PhidgetSetOnAttachHandler = GetProcAddress(ThisDLL, "CPhidget_set_OnAttach_Handler") PhidgetSetOnDetachHandler = GetProcAddress(ThisDLL, "CPhidget_set_OnDetach_Handler") ' PhidgetInterfaceKitSetOnSensorChangeHandler = getProcAddress(ThisDLL, "CPhidgetInterfaceKit_set_OnSensorChange_Handler") End If 'DebugStop() Global errorCode:Int Global gbAttached:Int = False Global gPhidgetHandle:Int Print PhidgetInterfaceKitCreate(gPhidgetHandle) Print PhidgetSetOnAttachHandler(gPhidgetHandle, Attach, Null) Print PhidgetSetOnDetachHandler(gPhidgetHandle, Detach, Null) 'Print PhidgetInterfaceKitSetOnSensorChangeHandler(gPhidgetHandle, OnSensorChanged, Null) Local serial:Int Print PhidgetGetSerialNumber(gPhidgetHandle, serial) Print PhidgetOpen(gPhidgetHandle, -1)'serial) Print "Waiting 3 seconds for Phidget board to attach..." errorCode = PhidgetWaitForAttachment(gPhidgetHandle, 3000) Print errorCode If errorCode = 13 Then Print "Time out. No Interface board found." ClosePhidget() End Else Print "run application" End If Rem While Not KeyHit(KEY_ESCAPE) Wend End End Rem Graphics 800, 600, 0, 60 SetClsColor(255, 255, 255) SetColor(0, 0, 0) While Not KeyHit(KEY_ESCAPE) Cls DrawText("Hello world", 50, 100) Flip Wend ClosePhidget() End Function ClosePhidget() Print "Close Phidget." Print PhidgetClose(gPhidgetHandle) Print PhidgetDelete(gPhidgetHandle) End Function Function Attach() Print "InterfaceKit Attached!" gbAttached = True End Function Function Detach() Print "InterfaceKit Detached!" gbAttached = False End Function Function OnSensorChanged() Print "SensorChanged" End Function
More info and dll downloads at www.phidgets.com