This file describes syntax of 24U Phidgets Plug-In's functions.
Returns version string of the active 24U Phidgets Plug-In, formatted as requested by the parameter.
versionFormat | Defines the format of the returned version. |
short | To get just the version number |
long | To get the plug-in name followed by its version number |
platform | To get the platform of the code currently running |
Attempts to unlock (register) your copy of 24U Phidgets Plug-In with the specified code.
registrationCode | The code to unlock the full version of the plug-in. |
If the code is valid, 24U Phidgets Plug-In gets unlocked and stays in this state until you quit the FileMaker Pro application, deactivate the plug-in, or the registration code expires. While unlocked, 24U Phidgets Plug-In is fully functional and does not bother the user with a shareware reminder.
Returns a non-zero result when operation is not permitted.
Reads data from the Phidget.
phidgetSN | The Phidget serial number. Use -1 for the first available device. |
valueID | Specifies which data should be read. |
index | Default to 0. Index of the port of IO Phidget or another index information if needed |
valueID | Phidget type | Description |
---|---|---|
"inputValue" | General | Returns value of the default input. |
"inputState" | Interface Kit | Returns the value of the digital input. |
"sensorValue" | Interface Kit | Returns the value of the analog input. |
"sensorRawValue" | Interface Kit | Returns the raw value of the analog input. |
"outputState" | Interface Kit | Returns the value of the analog output. |
"outputState" | RFID | Returns the state of the designated digital output. |
"motorPosition" | Servo | Reads the position of the motor. |
The "General" Phidget Type can be used with all Phidgets. The default input for all phidgets is the first valueID for each phidget in this list. For example calling Phidget_Read( -1 ; "inputValue" ) is the same as Phidget_Read( -1 ; "motorPosition" ) for PhidgetServo.
Function returns data from Phidget if everything is OK. In case of error the function returns "?". You can use Phidget_Get("lastError") for more detailed error description.
Phidget_Read(-1 ; "inputValue")
The most basic reading. This command will read an "inputValue" from a connected Phidget. If more than one device is connected the plug-in will choose the first device which was connected.
Phidget_Read(phidgetSN ; "sensorValue" ; 3)
Reads a value from the fourth sensor of the InterfaceKit. If the field phidgetSN does not contain correct serial number of the the Interface Kit Phidget (which must be connected in the time of reading) than the function will fail and returns "?".
Writes or set data to the Phidget.
phidgetSN | The Phidget serial number. Use -1 for the first available device. |
valueID | Specifies which data should be written. |
data | Data to write or set. Please use FileMaker number type for numbers and text for strings. The plug-in will try to convert them if necessary. |
index | Default to 0. Index of the port of IO Phidget or another index information if needed |
valueID | Phidget type | Description |
---|---|---|
"outputState" | General | Writes value to default output. |
"outputState" | Interface Kit | Write data to digital output. |
"outputState" | RFID | Writes the new value to the output. |
"motorPosition" | Servo | Sets the new motor position. |
The "General" valueIDs can be used with all sensors. The default output for all phidgets is the first valueID for each phidget in this list. For example calling Phidget_Write( -1 ; "outputState" ; 20 ) is the same as Phidget_Write( -1 ; "motorPosition" ; 20 ) for PhidgetServo.
Function returns 0 if everything is OK. In case of error the function returns negative error code or Phidget Error code.
Phidget_Write(-1 ; "outputState" ; 20)
This will write a value "20" to the first connected phidget if it is possible.
Phidget_Write(phidgetSN ; "motorPosition" ; 215)
It rotates the servo in PhidgetServo to 215 degrees. PhidgetSN parameter should contain a valid serial number of connected servo phidget.
Phidget_Write(69418 ; "outputState" ; 1 ; 5)
Sets the sixth output of the interface kit phidget with serial number 69418 to 1.
Tell the plug-in to launch the script when specified event is triggered by the Phidget or in specified time intervals.
phidgetSN | The Phidget serial number. Use -1 for the first available device. |
event | The event when the script should be triggered. Use FileMaker text to describe it. I.e. "onSensorChange". |
time | The time interval on which the script should trigger. Use FileMaker number i.e. 1.8. Time is in [s]. Time must be a positive number. Setting time lower than 1 s is not recommended. |
scriptName | The name of script which should be triggered. The script will receive a parameter which will contain at least phidgetSN on the first row. More values can be added depending on the event. |
index | The index of input or output to trigger the script. If omitted the script will be triggered every time when any of inputs/outputs are changed regardless of its number. |
changeAmount | The amount of change that should exist between the last reported value and the current value before an event triggers. The default is 1. This cannot be changed for binary inputs or outputs. Use FileMaker number. |
threshold | The script will not be triggered until the sensor value exceeds threshold. Use it as a simple noise filter. It has no meaning for binary inputs/outpus. The default value is 0 - no filtering. |
event | Phidget type | Description |
---|---|---|
"onAttach" | General | Run the script when some phidget is attached. PhidgetSN must be set to "all". |
"onDetach" | General | Run the script when some phidget is detached. PhidgetSN must be set to "all". |
"onInputChange" | General | Run the script when default input is changed. The amount can be set by changeAmount. |
"onInputChange" | Interface Kit | Run the script when digital input is changed. |
"onSensorChange" | Interface Kit | Run the script when the value from connected sensor is changed. The amount can be set by the changeAmount. |
"onOutputChange" | Interface Kit | Run the script when output is changed. |
"onTag" | RFID | Run the script when a tag will approach RFID sensor. |
"onTagLost" | RFID | Run the script when a the sensor losts the connection with a tag. |
"onOutputChange" | RFID | Run the script when output is changed. |
"onMotorPosChange" | Servo | The script when the motor position is changed. |
Some events are the same for more phidgets. The "General" event "onInputChange" can be installed to all listed phidgets and it will behave as their default input event. For example: Phidget_SetScriptEvent( -1 ; "onInputChange" ; "Do Something" ) has the same meaning as Phidget_SetScriptEvent( -1 ; "onMotorPosChange" ; "Do Something" ) for PhidgetServo or Phidget_SetScriptEvent( -1 ; "onTag" ; "Do Something" ) for PhidgetRFID. If "onInputChange" is used, the phidget type is detected automatically and the event is instaled to it.
In both cases (event/time) the script will receive a parameter containing the value list with phidgetSN, inputIndex and inputValue. Values for digital input can be "0" or "1" for analog it varies by the type of the event.
To remove event call Phidget_SetScriptEvent( phidgetID ; event/time ; "" ).
To remove all events from some phidget call Phidget_SetScriptEvent( phidgetID ; "" ; "" ).
To remove all events from all phidgets call Phidget_SetScriptEvent( "" ; "" ; "" ) or Phidget_SetScriptEvent( "all" ; "" ; "" ).
Function returns 0 if event is sucessfully installed or uninstalled. In case of error the function negative error code or Phidget Error code.
Phidget_SetScriptEvent(-1 ; 1.2 ; "Default Script")
This will install the script named "Default Script" to the first available connected phidget. The script will run every 1.2 second and it will obtain a parameter which consist of serial number, "0" and input value. Each on new line. The "0" signals that the input on index 0 is beeing read.
Phidget_SetScriptEvent(phidgetSN ; "onTag" ; "Process new tag")
The script "Process new tag" will be triggered every time the new RFID tag is in the vicinity of the RFID phidget. The script will receive a parameter with phidget serial number, "0" and RFID value of the tag. Each on the new line. The zero means, that the first input of RFID phidget is used.
Phidget_SetScriptEvent(69418 ; "onSensorChange" ; "Read sensor" ; 6 ; 10 ; 5)
This will install "onSensorChange" event to the interface kit phidget with serial number 69418. The phidget must be connected.
The "Read sensor" script will be triggered when the seventh sensor's value on the interface kit phidget with SN 69418 will change more than 10 points and will be higher than 5. The script will receive the parameter which will contain: "69418", "6" and sensor value. Each on the new line.
Phidget_SetScriptEvent("all" ; "onAttach" ; "New phidget attached")
The script "New phidget attached" will be called every time when user will connect a new phidget to the system. The script will receive a parameter with serial number of the new connected phidget.
Function to get plug-in or phidget settings and other useful data.
what | Which data shoud be get. |
more | Additional specifier to concretize the request. |
what | Phidget type | Description |
---|---|---|
"lastError" | Not used | Returns the error code of the last error. If no error occured 0 is returned. |
"libraryVersion" | Not used | Get version of Phidget Library installed on system. |
"attachedDevices" | Not used | Get number of attached devices. |
"serialNumber" | Phidget Index | Serial number of the device with index specified in "more" parameter. |
"deviceType" | PhidgetSN | Type of the device specified by PhidgetSN. |
"deviceName" | PhidgetSN | Name of the device specified by PhidgetSN. |
"deviceVersion" | PhidgetSN | Version of the device specified by PhidgetSN. |
"deviceLabel" | PhidgetSN | Label of the device specified by PhidgetSN. |
"numInputs" | PhidgetSN | The number of default inputs. |
"numOutputs" | PhidgetSN | The number of default outputs. |
"numSensors" | PhidgetSN of Interface Kit | Number of sensors. |
"ratiometric" | PhidgetSN of Interface Kit | Returns phidget ratiometric status. |
"antennaOn" | PhidgetSN of RFID Phidget | The status of the antenna of the RFID reading device. |
"ledOn" | PhidgetSN of RFID Phidget | The status of the LED. |
The "more" parameter is usually used to specify Phidget Serial Number. Some commands need specific PhidgetSN (of specific type) otherwise they will fail. Some commands are more general. You can use PhigetSN value "-1" to specify the default Phidget.
The boolean values are returned in number form. For example Phidget_Get("antennaOn" ; -1) returns 0 if backlight is off and 1 if backlight is on.
Function returns data if everything is OK. In case of error the function returns "?". You can use Phidget_Get("lastError") for more detailed error description.
Phidget_Get("attachedDevices")
Returns the number of attached devices. If no phidget is attached to the machine it will return 0. It is a good command to start with to check if any phidget is connected.
Phidget_Get("serialNumber" ; 3)
If you have four phidgets connected to the machine this will return the serial number of the fourth one. Use this command in the loop (along with previous one) to enumerate serial numbers of all phidgets connected to the machine.
Phidget_Get("deviceType" ; 69418)
This will check the connected phidget with SN 69418 and returns its type. The types are textual in human readable form. For the supported types the result can be: "PhidgetInterfaceKit", "PhidgetRFID" and "PhidgetServo". In general the type names are the same as the official ones.
Function to set plug-in or phidget settings and other useful data.
what | Which data shoud be set. |
value | The new value. |
phidgetSN | The Phidget serial number. Use -1 for the first available device. |
what | Phidget type | Description |
---|---|---|
"ratiometric" | Interface Kit | Sets phidget ratiometric. The phidget with ratiometric will measure more precise if ratiometric sensor (marked with R) is attached. |
"antennaOn" | RFID | Sets the status of the antenna of the RFID reading device. |
"ledOn" | RFID | Sets the status of the LED. |
"motorOn" | Servo | Turns a Motor On & Off. |
Function returns set value if everything is OK. In case of error the function returns "?". You can use Phidget_Get("lastError") for more detailed error description.
Phidget_Set("ratiometric" ; 1 ; 69418)
Set the ratiometric value to 1 (turns on) in the phidget with SN 69418. This phidget must be interface kit phidget otherwise "?" is returned.
Phidget_Set("ratiometric" ; 1 ; -1)
Set the ratiometric value to 1 (turns on) in the first phidget it founds. This phidget must be interface kit phidget otherwise "?" is returned. Use this form if you have only one phidget connected to the computer and you are sure that you will never connect any other phidget otherwise the result can be unpredictable.