Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/USB/Phidget/PhidgetAccelerometer Test with Events
Function:
Required plugins for this example: MBS USB Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /USB/Phidget/PhidgetAccelerometer Test with Events
This example is the version from Sun, 17th Mar 2012.
Project "PhidgetAccelerometer Test with Events.rbp"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control StaticText7 Inherits Label
ControlInstance StaticText7 Inherits Label
End Control
Control StaticText8 Inherits Label
ControlInstance StaticText8 Inherits Label
End Control
Control StaticText9 Inherits Label
ControlInstance StaticText9 Inherits Label
End Control
Control StaticText10 Inherits Label
ControlInstance StaticText10 Inherits Label
End Control
Control StaticText11 Inherits Label
ControlInstance StaticText11 Inherits Label
End Control
Control StaticText12 Inherits Label
ControlInstance StaticText12 Inherits Label
End Control
Control StaticText13 Inherits Label
ControlInstance StaticText13 Inherits Label
End Control
Control StaticText14 Inherits Label
ControlInstance StaticText14 Inherits Label
End Control
Control StaticText15 Inherits Label
ControlInstance StaticText15 Inherits Label
End Control
Control StaticText16 Inherits Label
ControlInstance StaticText16 Inherits Label
End Control
Control StaticText17 Inherits Label
ControlInstance StaticText17 Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() StaticText11.text=p.GetDeviceLabel StaticText10.text=p.GetDeviceName StaticText13.text=hex(p.GetDeviceStatus) StaticText12.text=p.GetDeviceType StaticText14.text=hex(p.GetDeviceVersion) StaticText15.text=hex(p.GetSerialNumber) StaticText16.text=str(p.getAcceleration(0)) StaticText17.text=str(p.getAcceleration(1)) StaticText18.text=str(p.getAcceleration(2)) End EventHandler
End Control
Control StaticText18 Inherits Label
ControlInstance StaticText18 Inherits Label
End Control
Control ListBox1 Inherits Listbox
ControlInstance ListBox1 Inherits Listbox
End Control
EventHandler Sub Close() p.Close End EventHandler
EventHandler Sub Open() ' call loadPhidgetFrameworkMBS, LoadPhidgetWindowsDLLMBS or LoadPhidgetLinuxLibraryMBS p=new MyPhidgetAccelerometerMBS // -1 for first device p.Open -1 End EventHandler
Property Protected p As PhidgetAccelerometerMBS
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() dim f as FolderItem f=FrameworksFolderMBS(-32765).Child("Phidget21.framework") if LoadPhidgetFrameworkMBS(f) then MsgBox "Framework loaded" else MsgBox "Failed to load framework" end if // use LoadPhidgetWindowsDLLMBS on Windows // use LoadPhidgetLinuxLibraryMBS on Linux End EventHandler
End Class
Class MyPhidgetAccelerometerMBS Inherits PhidgetAccelerometerMBS
EventHandler Sub AccelerationChanged(index as integer, value as double) window1.ListBox1.AddRow "AccerlerationChanged index: "+str(index)+" value: "+str(value) End EventHandler
EventHandler Sub Attach() window1.ListBox1.AddRow "Attached" End EventHandler
EventHandler Sub Detach() window1.ListBox1.AddRow "Detached" End EventHandler
EventHandler Sub Error(errorCode as integer, errorDescription as string) window1.ListBox1.AddRow "Error "+str(errorCode)+": "+errorDescription End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS USB Plugin.




Links
MBS FileMaker Plugins