Phidgets and MBS

I’m trying to get Phidgets working using MBS plugins. In all cases when I use the examples, I always get a ‘Could not load DLL’ error. Here is the load line:

dim b as boolean = LoadPhidgetWindowsDLLMBS("C:\Program files\Phidgets\Phidget22\phidget22.dll")

p=new MyPhidget

DLL file exists and all is working using Phidgets installed software. I cannot see any obvious MBS plugin dependency that I’m missing. Tried both the Phidget manager and Phidget RFID Test examples. I’m using MBS Plugins 21.1. Due to release of Phidget22, assume the MBS plugin is coded against this dll version.

Any ideas welcome. Got a feeling it’ll be something simple that I’m overlooking…

Looks like you use the older phidget classes with the newer DLL, which won’t work.

Please use phidget21.dll for this function or move to newer plugins.

2 Likes

Here’s my initialization code:

#If TargetWindows
  Const path = "Phidget22.dll"
#ElseIf TargetMacOS Then
  Const path = "/Library/Frameworks/Phidget22.framework"
#EndIf

If not PhidgetManagerMBS.LoadLibrary(path) Then
  MsgBox "Phidgets load error:." + EndofLine+PhidgetManagerMBS.LibraryLoadError
  Return
End If

PhidgetManager = New MyPhidgetManager
PhidgetManager.Open

In the Attached event of MyPhidgetManager:

If LightController = Nil Then
  LightController = new PhidgetDigitalOutputMBS
  LightController.IsHubPortDevice = True
  LightController.Channel = 0
  LightController.HubPort = 0
  LightController.open
End

This particular app is super-simple and only expects one Phidget. Attachment handling needs to be more complex if you’re doing more I/O.

To control the lights I have a method SetLight(Value as Boolean)

If PhidgetManager <> Nil Then
  If LightController <> nil then
    If LightController.Attached Then
      LightController.State = Value
    End
  End
End
2 Likes

Thanks @Christian_Schmitz. Narrowed in when I saw App.Open was expecting …21.dll.

Thanks @Julia_Truchsess - just starting out with Phidgets so good to get some tips :slight_smile:

Steve

Phidgets are super-awesome and easy to use. I’ve done some pretty complex automated test systems with them, happy to help further.

1 Like

@SteveP Here’s a blog post that I wrote that you might find to be helpful: Xojo: Develop A Desktop App to Monitor An Environment's Temperature, Humidity, and More

It’s about a Xojo desktop app that uses Phidgets and the MBS plugins. Specifically, I’m using Phidgets to get temperature, humidity, and illuminance.

The project is available via a link in the “Wrapping Up” section.

4 Likes

Thanks @Tim_Dietrich I’ll take a look