Quickfixes for this minor version:
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 |
phidgetlib | To get the version of Phidget library. |
Phidget_Version("phidgetlib")
This will return for example: "Phidget21 - Version 2.1.8 - Built Aug 21 2015 10:20:29"
Provides special functionality to operate with plugin serial numbers.
selector | Define the type of operation. |
SerialNumber | Register given SerialNumber and return an error code. |
EmailAddress | Tries to activate with given email address and return an error code. Trial version is valid only after you confirm email. |
"Registration Window" | Show the "Registration window" and return 0. |
"About Window" | Show the "About window" and return 0. |
"Status" | Return the actual registration state of the plugin: Demo, Demo expired, Trial, Trial Expired, Registered or Dead. |
"Unregister" | Unregister all serial numbers related to the product and return an error code. Note: after this trial version days wont come back. |
Phidget_Register( "address@example.com" )
This will send email on address@example.com for confirmation, if you confirm than you will get trial version on this product verified by this email.
Phidget_Register( "PHD20C666-4B7B-37PH-Q2E6-1UKY" )
This will register this product with key: "PHD20C666-4B7B-37PH-Q2E6-1UKY".
Phidget_Register( "Unregister" )
This will remove all registered keys. After this call product is no longer registered.
Returns zero or error code depending on the selector.
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 |
extra | Specifies some options for specific Phidget type. |
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. |
"tag" | RFID | Reads the RFID tag value. Note: before reading antenna on device has to be on. See Phidget_Set. |
"motorPosition" | Servo | Reads the position of the motor. |
"bridgeValue" | Bridge | Reads the value of port (port has to be enabled). |
"voltage" | Analog | Reads voltage level on port of Phidget Analog. |
extra | Phidget type | Description |
---|---|---|
"autoDetect" | RFID |
Use this flag to autodetect the tag protocol from the tag.
Without this flag, the first 5 characters of the tag content is converted into 10 character long string
to ensure backward compatibility with solutions created for plug-in version 1.x.
Note: all new solutions are recommended to use this flag. |
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 "?".
Phidget_Read(phidgetSN ; "bridgeValue" ; 1)
Reads value from port 1 on Phidget Bridge. If the port is disabled or any other error occured than the function will fail and returns "?".
Phidget_Read(335882 ; "tag")
Reads tag value from Phidget RFID.
Phidget_Read(335882 ; "tag")
Assume, that tag contains value "hello world!" using protocol PHIDGET. Because "autoDetect" is not used, output value is converted to "68656c6c6f".
Phidget_Read(335882 ; "tag" ; 0 ; "autoDetect")
Assume, that tag contains value "hello world!" using protocol PHIDGET. This returns "hello world!".
Data to the Phidget are written or set.
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 |
tagProtocol | Default to PHIDGETS. See tag protocols for more information. |
valueID | Phidget type | Description |
---|---|---|
"outputState" | General | Write value to default output. |
"outputState" | Interface Kit | Write data to digital output. |
"outputState" | RFID | New value to the output is written. |
"tag" | RFID | New tag is written. Note: antenna has to be turned on before reading. See Phidget_Set. |
"motorPosition" | Servo | Sets the new motor position. |
"displayString" | TextLCD | New text to LCD is written on the first row. |
"voltage" | Analog | Allows to set voltage level of given port. Don't forget to enable port in order to make it work. |
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.
Phidget_Write( 335882 ; "tag" ; "Your text." )
New tag is written. Used tag protocol: PHIDGETS (See tag protocols for more information.)
Phidget_Write( phidgetSN ; "tag" ; "999123456789012"; 0 ; "ISO11785_FDX_B" )
New tag is written. Used tag protocol: ISO11785_FDX_B (See tag protocols for more information.)
Phidget_Write( phidgetSN ; "tag" ; "123456789a"; 0 ; "EM4100" )
New tag is written. Used tag protocol: EM4100 (See tag protocols for more information.)
Phidget_Write( phidgetSN ; "displayString" ; "Hello World!"; 0)
New text is written on the first row. Note: Rows are indexed from zero. If text is not visible, please check backlight, brightness and contrast.
Phidget_Write( phidgetSN ; "displayString" ; "special chars: "& char(224) & char(225) & char(226) & char(227) ; 1)
Special characters on the first row are written. More about special characters can be found here.
Phidget_Write( phidgetSN ; "outputState" ; 2,6 ; 1)
Set output voltage to 2,6V on port 1 (assuming this port is enabled).
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 analog input or output to trigger the script. The script will be triggered only if the value will exceed changeAmount. 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. Param changeAmount can be used only on onSensorChange event, it is ignored on other events. |
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/outputs. The default value is 0 - no filtering. |
event | Phidget type | Description | Script is given parameters: |
---|---|---|---|
"onAttach" | General | Run the script when some phidget is attached. PhidgetSN must be set to "all". | PhidgetSN. |
"onDetach" | General | Run the script when some phidget is detached. PhidgetSN must be set to "all". | PhidgetSN. |
"onInputChange" | General | Run the script when default input is changed. | PhidgetSN index value |
"onInputChange" | Interface Kit | Run the script when digital input is changed. | PhidgetSN index value |
"onSensorChange" | Interface Kit | Run the script when the value from connected sensor is changed. The amount can be set by the changeAmount. | PhidgetSN index value |
"onOutputChange" | Interface Kit | Run the script when output is changed. | PhidgetSN index value |
"onTag" | RFID | Run the script when a tag approaches RFID sensor. | PhidgetSN index tagBackwardCompatibleString tagValueString |
"onTagLost" | RFID | Run the script when a the sensor losts the connection with a tag. | PhidgetSN index tagBackwardCompatibleString tagValueString |
"onOutputChange" | RFID | Run the script when output is changed. | PhidgetSN index value |
"onMotorPosChange" | Servo | Run the script when the motor position is changed. | PhidgetSN index value |
"onBridgeData" | Bridge | Run the script when dataRate time has passed. | PhidgetSN index value |
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 installed to it.
Param changeAmount can be used only on onSensorChange event. On other events it is ignored.
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( phidgetSN ; event/time ; "" ).
To remove all events from some phidget call Phidget_SetScriptEvent( phidgetSN ; "" ; "" ).
To remove all events from all Phidgets call Phidget_SetScriptEvent( "" ; "" ; "" ) or Phidget_SetScriptEvent( "all" ; "" ; "" ).
Function returns 0 if event is successfully 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 should be get. |
more | Additional specifier to concretize the request. |
index | Additional specifier to get data for specific part (see example). |
what | Phidget type | Description |
---|---|---|
"lastError" | Not used | Returns the error code of the last error. If no error occurred 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" | Interface Kit | Number of sensors. |
"ratiometric" | Interface Kit | Returns phidget ratiometric status. |
"antennaOn" | RFID | The status of the antenna of the RFID reading device. |
"ledOn" | RFID | The status of the LED. |
"tagProtocol" | RFID | Returns RFID tag protocol. See tag protocols for more information. |
"backlight" | TextLCD | Gets the state of the backlight. |
"brightness" | TextLCD | Gets the brightness of the backlight. (Not supported on all TextLCDs) |
"contrast" | TextLCD | Gets the last set contrast value. |
"numRows" | TextLCD | Gets number of rows on LCD display. |
"numColumns" | TextLCD | Gets number of columns on LCD display. |
"cursorOn" | TextLCD | Gets '1' if cursor is on.. |
"cursorBlink" | TextLCD | Gets '1' if cursor should be blinking. |
"enabled" | Bridge and Analog | Gets "1" if port is enabled. |
"dataRateMin" | Bridge | Gets minimal possible data rate. |
"dataRateMax" | Bridge | Gets maximum possible data rate. |
"dataRate" | Bridge | Gets actual data rate for getting values from bridge automatically. |
"gain" | Bridge | Gets the value of actual gain (something and precision). |
"bridgeMin" | Bridge | Gets bridge minimal possible value on port. |
"bridgeMax" | Bridge | Gets bridge maximal possible value on port. |
"voltageMin" | Analog | Gets voltage minimal possible value on port. |
"voltageMax" | Analog | Gets voltage maximal possible value on port. |
"servoMin" | AdvancedServo | Get minimal value for servo position. |
"servoMax" | AdvancedServo | Get maximal value for servo position. |
"engaged" | AdvancedServo | Gets '1' if servo on position is on. |
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")
This will return 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.
Phidget_Get("deviceType" ; 120538 ; 1)
This will return device type of given PhidgetSN, however it will try to locate the second type of given PhidgetSN. Example: you have TextLCD combined with InterfaceKit, this allows you to get device type of the second device.
Phidget_Get("enabled" ; 140923 ; 2)
This will check if port 2 on Phidget Bridge is enabled. Port has to be enabled, if we want to read data.
Phidget_Get("dataRateMin" ; 140923)
This will return minimal rate in Phidget Bridge. Value is in ms and if you set data rate, it should be lesser or equal.
Phidget_Get("numColumns" ; 120538)
This will return number of columns of Text LCD with SN 120538.
Phidget_Get("numRows" ; 120538)
This will return number of rows of Text LCD with SN 120538.
Phidget_Get("contrast" ; 120538)
This will return current value of contrast of Text LCD with SN 120538.
Phidget_Get("brightness" ; 120538)
This will return current value of brightness of Text LCD with SN 120538.
Phidget_Get("backlight" ; -1)
This will return backlight status of the first found Text LCD.
Function to set plug-in or phidget settings and other useful data.
what | Which data should be set. |
value | The new value. |
phidgetSN | The Phidget serial number. Use -1 for the first available device. |
index | Index of changed value. |
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. |
"backlight" | TextLCD | Sets the state of the backlight. Possible values are 1 and 0. |
"brightness" | TextLCD | Sets the brightness of the backlight. Not supported on all TextLCDs. Possible values of brightness are 0-255. |
"contrast" | TextLCD | Sets the contrast value. Possible values of contrast are 0-255. |
"cursorOn" | TextLCD | This allows to turn on/off cursor. |
"cursorBlink" | TextLCD | If cursor is on, then you can turn on/off its blinking. |
"enabled" | Bridge and Analog | This will enable port on given index. |
"gain" | Bridge | This will allow you to set gain of data from the bridge; |
"dataRate" | Bridge | This will allow you to set data rate of incomming data. |
"motorOn" | Servo | Turns a Motor On & Off. |
"servoMax" | AdvancedServo | Allow to set minimal value for servo (prevents servo from being damaged). |
"servoMin" | AdvancedServo | Allow to set maximal value for servo (prevents servo from being damaged). |
"engaged" | AdvancedServo | This will allow to turn on/off servo. |
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)
This will 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)
This will 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.
Phidget_Set( "backlight" ; 1 ; 120538)
This will set the state of the backlight. Possible values 0 (off) or 1 (on).
Phidget_Set( "contrast" ; 155 ; 120538)
This will set the contrast value. Possible values 0-255.
Phidget_Set( "motorOn" ; 1 ; 170192 ; 3)
This will turn on the fourth motor.
Phidget_Set( "motorOn" ; 0 ; 170192 ; 0)
This will turn off the first motor.
Phidget_Set( "enabled" ; 1 ; 140912 ; 3)
This will enable port 3 on Bridge.
Phidget_Set( "dataRate" ; 200 ; 140923)
This will set data rate of Phidget Bridge on 200 ms. Be careful - data rate should be between data rate min and data rate max.
Phidget_Set( "enabled" ; 1 ; 131907 ; 3)
This will enable port 3 on Analog (assuming proper phidgetSN was given).
Function to connect to SBC via network.
address | Address of SBC in network. |
password | Password for security. |
port | Port of service. In case you wont use, port 5001 is used. |
Function return 0, if everything OK, if function returns "?". You can use Phidget_Get("lastError") for more detailed error description. However, even if function returns 0, it doesn't mean that SBC is already connected. If you have slow network, then it can take some time. Connected SBC will trigger "onAttach" script (if set).
Phidget_Connect("10.0.3.51" ; "111111")
Try to establish connection to address 10.0.3.51 with password "111111" on port 5001.
FileMaker example of using this feature can be found here.
Function to disconnect from SBC.
address | Address of SBC in network. |
Function return 0, if everything OK, if function fails - it returns "?". You can use Phidget_Get("lastError") for more detailed error description.
Phidget_Disconnect("10.0.3.51")
Disconnects from address 10.0.3.51.
This section explain tag protocols used for writing on RFID tag.
Tag protocol specifies, which format of input data is accepted. Table below shows supported protocols.
Tag protocol | Accepted value |
---|---|
PHIDGETS | Strings or numbers (integer). |
ISO11785_FDX_B | Strings with 15 numbers (3 state code, 12 animal code). |
EM4100 | Strings of 10 hexadecimal numbers (0-f). |
-50 | Means paramErr, Phidget_ has wrong parameters. | |
-36 | Returned when RFID Reader / Writer has not RFID tag to read / write. | |
24001 | Demo mode expired. | If you want to keep using the plug-in, you must register it or buy it for particular environment. |
24002 | Product expired. | Trial period is over. If you want to keep using the product, you must buy it for particular environment. |
24003 | SN limit was met. | The serial number is already registered on too many computers. |
24004 | Product is dead. | The product expired and cannot be used any more. Please download the new version from 24U Software. |
24005 | Invalid serial number. | Serial number you entered is not valid. |
24006 | Activation failed. | Activation failed probably due to some network error. Please, check your connection to the internet and try again later. |
24007 | Deactivation failed. | Deactivation failed probably due to some network error. Please, check your connection to the internet and try again later. |
24008 | Unknown serial number. | The given serial number cannot be used for the current product. It has been stored so that other product can try to use it. |
24009 | Blacklisted serial number. | The given serial number has been blacklisted and cannot be used anymore. Please, contact 24U Support if you need more information. |
24010 | eSellerate engine not installed. | This product uses eSellerate to validate user registration and purchases, but its installation failed. Please, reboot the computer or try again later. |