24U ConnectBridge for Arduino 1.0 Syntax

Arduino_Version ( { versionFormat } )

Returns version string of the active 24U ConnectBridge for Arduino, formatted as requested by the parameter.

Parameters

versionFormatDefines the format of the returned version.

Parameter values for versionFormat

shortTo get just the version number
longTo get the plug-in name followed by its version number
platformTo get the platform of the code currently running
autoupdateTo get the version of plug-in binary file

Examples

Arduino_Version("long")
This will return for example: "24U ConnectBridge for Arduino 1.0"

Arduino_Register(selector)

Provides special functionality to operate with plug-in serial numbers.

Parameters

selectorDefines the type of operation.

Parameter values for versionFormat

SerialNumber Register given SerialNumber and return an error code.
EmailAddress Tries to activate Plug-In 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 plug-in: 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.

Examples

Arduino_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.

Arduino_Register( "ARD20C666-4B7B-37PH-Q2E6-1UKY" )
This will register this product with key: "ARD10C156-4B7B-37PH-Q2E6-1UKY".

Arduino_Register( "Unregister" )
This will remove all registered keys. After this call product is no longer registered.

Result

Returns zero for success or '?' - use Arduino_Get("lastError") to get error code.

Arduino_Connect( connectionID { ; baud} )

Establishes connection to Arduino. Must be called before Arduino_Read and Arduino_Write can work.

Parameters

connectionIDArduino connection ID. More about connectionID is here.
baudAllows to specify speed of received/sent data.Default value is 115200

Result

Function return 0, if everything OK, if function returns "?". You can use Arduino_Get("lastError") for more detailed error description. However, even if function returns 0, it doesn't mean that Arduino is already connected. If you have slow network, then it can take some time.

Examples

Arduino_Connect("10.0.3.51")
Try to establish connection to address 10.0.3.51 (Arduino has to be connected to network by Ethernet or wi-fi).

Arduino_Connect("COM3")
Tries to connect to Arduino on serial port COM3 (on Windows).

Arduino_Connect("/dev/tty0")
Tries to connect to Arduino on serial port /dev/tty0 (on macOS).

Arduino_Disconnect( connectionID )

Use this function for disconnecting Arduino from plug-in.

Parameters

connectionIDArduino connectionID. More about connectionID is here.

Result

Function returns 0, if everything is OK, if function fails - it returns "?". You can use Arduino_Get("lastError") for more detailed error description.

Examples

Arduino_Disconnect("10.0.3.51")
Disconnects Arduino on the address 10.0.3.51.

Arduino_Disconnect("COM3")
Disconnects PlugInPlug-In from Arduino on COM3.

Arduino_Read ( connectionID ; valueID { ; param1 ; ... ; paramN } )

Reads data from the Arduino.

Parameters

connectionIDArduino connection ID. More about connectionID is here.
valueIDSpecifies which data should be read.
param1 ... paramNOther parameters based on valueID.

Parameter values for valueID

valueID Description
"inputState" Returns the value of the digital input.
"sensorRawValue" Returns the raw value of the analog input.
"temperature" Reads temperature from connected LM35 temperature sensor
"voltage" Reads voltage level on port of Arduino Analog.
"eeprom" Reads data from Arduino EEPROM memory (data will stay saved even after power is down)
"iic" Tries to read data from IIC bus
"spi" Tries to read data from SPI bus

Parameter values for param1...paramN

valueID param1 param2 param3
"inputState" pinNumber - possible values are 2-13
"sensorRawValue" analogPin - possible values are A0-A5
"temperature" analogPin - possible values are A0-A5
"voltage" analogPin - possible values are A0-A5
"eeprom" typeOfData - can be "text" or "number" address - number from 0 to 700 size
"iic" address of device Number of bytes to read data to be sent (e.g. hexadecimal codes of command for device)
"spi" CS - pin for selecting slave Number of bytes to read data to be sent (e.g. hexadecimal codes of command for device)

Result

Function returns data from Arduino if everything is OK. In case of error the function returns "?". You can use Arduino_Get("lastError") for more detailed error description.

Examples

Arduino_Read("COM3" ; "inputState" ; "3")
Reads state of digital input on pin 3.

Arduino_Read("COM3" ; "sensorRawValue" ; "A0")
Reads raw value of the sensor on analog pin A0 and returns value in range 0 - 1000.

Arduino_Read("/dev/cu.usbmodem1411" ; "temperature" ; "A0")
Reads LM35 temperature sensor connected to analog pin A0 and returns value in celsius.

Arduino_Read("/dev/cu.usbmodem1411" ; "voltage" ; "A0")
Reads value on analog pin A0 and returns value in voltage (0 - 5V).

Arduino_Read("COM3" ; "iic" ; "0x68" ; 3 ; 0)
Will send 1B with value 0 into device on address 0x68 and tries to read 3B of data. This data will be returned as hexa codes (e.g: 0x123456 or 0xFFFFFF)

Arduino_Read("COM3" ; "spi" ; 10 ; 0x33)
Sends 0x33 to SPI device and reads data. Pin 10 means that SS pin of device has to be connected to pin 10 of Arduino.

Arduino_Read("/dev/tty0" ; "iic" ; "0x68" ; 10)
Attempts to read 10B of data from iic bus (from device on address) 0x68.

Arduino_Write( connectionID ; valueID { ; param1 ; ... ; paramN } )

Data to the Arduino are written or set.

Parameters

connectionIDArduino connection ID. More about connectionID is here.
valueIDSpecifies which data should be read.
param1 ... paramNOther parameters based on valueID.

Parameter values for valueID

valueID Description
"outputState" Write data to digital output.
"analogWrite" Write analog output.
"motorPosition" Sets the new motor position (for Servo). Move Stepper by given steps (Stepper).
"displayString" New text to LCD is written on the first row.
"eeprom" Writes data to EEPROM memory (content of memory remains even after power is down).
"iic" Sends data over iic bus.
"spi" Sends data over spi bus.
"stepperContinuously" Starts moving stepper motor by given direction or stops it completely.
"tone" Plays tone on Arduino (if speaker is connected), Note: analogWrite as well servos won't work on pins 3 and 11 if tone is in progress. Only one tone can be played at the time

Parameter values for param1...paramN

>
valueIDparam1param2param3 param4 param5
"outputState" pinNumber - possible values are 2-13 "HIGH" or "LOW"1 or 0
"analogWrite" pinNumber - PWM supporting pin 0-255
"motorPosition" motorType - can be "Servo" or "Stepper" value motorPin motorPinN
"displayString" row text
"eeprom" typeOfData - can be "text" or "number" address - number size - size of data to write data1-dataN
"eeprom" "text" address - number length of text in bytes * 2 textToBeWritten
"eeprom" "number" address - number size of number in bytes (possible values are 1, 2, 4, 8) number1-numberN
"iic" address of device data - data to be sent (e.g. hexadecimal codes of command for device)
"spi" CS - pin for selecting slave data - data to be sent (e.g. hexadecimal codes of command for device)
"stepperContinuously" direction - can be 1 or 0 or -1 value motorPin1 ... motorPinN
"tone" pinNumber frequency - value in Hz(at least 31) delayOfTone (max 1s) - during playing Arduino is unable to do anything else

Description

Writes data to Arduino or connected device. Parameters can be different for different types of valueID - see table above.

Result

Function returns 0 if everything is OK. Function returns '?' if error was detected. Use Arduino_Get("lastError") for more information.
Function can return 0 even if error happens in device (e.g. Arduino writes to Servo, but servo is damaged and won't move)

Examples

Arduino_Write( "/dev/cu.usbmodem1411"; "outputState" ; 2 ; 1)
Sets the 2nd digital pin to 1.

Arduino_Write( connectionID"/dev/cu.usbmodem1411" ; "analogWrite" ; 9 ; 255 )
Writes value 255 on pwm pin 9 (corresponds to 5V on 5V boards).

Arduino_Write( connectionID"/dev/cu.usbmodem1411" ; "motorPosition" ; "Servo" ; 180 ; 9)
It rotates the servo to 180 degrees.

Arduino_Write( connectionID"/dev/cu.usbmodem1411" ; "motorPosition" ; "Stepper" ; 215)
It rotates the stepper by 215 steps.

Arduino_Write( connectionID"/dev/cu.usbmodem1411" ; "motorPosition" ; "Stepper" ; -215 ; 9 ; 10 ; 11 ; 12)
It rotates the stepper by 215 steps - but in oposite direction as in previous example.

Arduino_Write( connectionID"/dev/cu.usbmodem1411" ; "stepperContinuously" ; -1 ; 9 ; 10 ; 11 ; 12)
It rotates stepper continuously (opposite to its default rotation direction).

Arduino_Write( connectionID"/dev/cu.usbmodem1411" ; "displayString" ; 1 ; "helloWorld!")
It writes given text to LCD display on row 1.

Arduino_Write( connectionID"/dev/cu.usbmodem1411" ; "displayString" ; 2 ; "I'm Arduino!")
It writes given text to LCD display on row 2.

Arduino_Write( "/dev/cu.usbmodem1411" ; "tone" ; 8 ; 261; 0,25)
It plays C note on buzzer connected to pin 8 for 1/4 of second.

Arduino_Write("COM5" ; "eeprom" ; "number" ; 0 ; 1 ; 1 ; 2 ; 3) & ", " & Arduino_Read("COM5" ; "eeprom" ; "number" ; 0 ; 1 ) & ", " & Arduino_Read("COM5" ; "eeprom" ; "number" ; 1 ; 1 ) & ", " & Arduino_Read("COM5" ; "eeprom" ; "number" ; 2 ; 1 )
This call will write numbers 1, 2 and 3 - each number will take 1B of memory (3B together). Then it performs reading. As you can see, writing multiple numbers is possible, but only one number can be read at given time.

Arduino_SetScriptEvent( connectionID ; event/time ; scriptName { ; index { ; changeAmount { ; threshold } } } )

Tell the plug-in to launch the script when specified event is triggered by the Arduino or in specified time intervals.

Parameters

connectionIDArduino connection ID. More about connectionID is here.
eventThe event when the script should be triggered. Use FileMaker text to describe it. I.e. "onSensorChange".
scriptNameThe name of script which should be triggered. The script will receive a parameter which will contain at least ArduinoNArduino on the first row. More values can be added depending on the event.
indexThe index of analog input 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. pin 0 will be used in case of "onInputChange and pin a0 in case of onSensorChange.
changeAmountThe 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.
thresholdThe 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.

Parameter values for event

event DescriptionScript is given parameters:
"onInputChange" Run the script when digital input has changed. connectionID index value
"onSensorChange" Run the script when the value from connected sensor has changed. The amount can be set by the changeAmount. connectionID index value

Description

To remove event call Arduino_SetScriptEvent( connectionID ; event ; "" ).
To remove all events from some Arduino call Arduino_SetScriptEvent( connectionID ; "" ; "" ).
To remove all events from all Arduino call Arduino_SetScriptEvent( "" ; "" ; "" ) or Arduino_SetScriptEvent( "all" ; "" ; "" ).

Result

Function returns 0 if event is successfully installed or uninstalled. In case of error the function return "?". You can use Arduino_Get("lastError") to get more detailed description.

Examples

Arduino_SetScriptEvent("COM3" ; "onSensorChange" ; "Read sensor" ; "A3" ; 10 ; 5)
This will install "onSensorChange" event to analog input on Arduino with connectionID "COM3". The Arduino must be connected. The "Read sensor" script will be triggered when the A3 sensor's value on the Arduino connected on port "COM3" change more than 10 points and will be higher than 5. The script will receive the parameter which will contain: "COM3", "A3" and sensor value. Each value separated by new line.

Arduino_Get( what { connectionID ; more ; index } )

Function to get plug-in or Arduino settings and other useful data. Use this function to get settings from Arduino.

Parameters

whatWhich data should be get.
connectionIDArduino connection ID. More about connectionID is here.
moreAdditional specifier to concretize the request.
indexAdditional specifier to get data for specific part (see example).

Parameter values for what

what Description
"lastError" Returns the error code of the last error. If no error occurred 0 is returned.
"lastErrorMessage" Returns error text description from the last plugin call.
"connectedDevices" Get numberlist of connected Arduinos.
"availableBoards" Get list of connection ids of attached Arduinos.
"firmwareVersion" Get version of 24U Firmware for Arduino inside Arduino board.
"lanType" Type of LAN connection.
"ethernet" IP address setfor ethernet connection.
"wifi" IP address setfor wifi connection.
"boardInfo" Will return list of active settings on Arduino board.
"lcdSetting" Will return list of settings for LCD display.
"lcdEnabled" Will return status of LCD on Arduino.
"stepperSetting" Will return list of settings for Stepper.
"stepperEnabled" Will return status of Stepper.
"pinSetting" Will return mode of given pin. Possible values are: "none", "lcd", "stepper", "digitalInput", "digitalOutput", "analogInput", "analogOutput" or "wifi", "ethernet" or "wifiRx" or "wifiTx".

Description

The "more" parameter is usually used to specify Arduino connectionID.

Result

Function returns data if everything is OK. In case of error the function returns "?". You can use Arduino_Get("lastError") for more detailed error description.

Examples

Arduino_Get("attachedDevices")
This will return the number of attached devices. If no Arduino is attached to the machine it will return 0. It is a good command to start with to check if any Arduino is connected.

Arduino_Get("lanType" ; "COM3")
This will return status of internet connection type on Arduino (default is "none").

Arduino_Get("lcdSetting" ; "COM3")
This will return status of LCD pins. Default values are: "RS=12, E=11, D4=5, D5=4, D6=3, D=72".

Arduino_Get("lcdEnabled" ; "COM3")
This will return status of LCD pins. Default values is: "disabled".

Arduino_Set( what ; value { ; connectionID { ; index}})

Function to set plug-in or Arduino settings and other useful data. Use this function for enabling/disabling features on Arduino. Some features need to be set first (e.g. ethernet or wi-fi).

Parameters

whatWhich data should be set.
valueThe new value.
indexIndex of changed value.
connectionIDArduino connection ID. More about connectionID is here.

Parameter values for what

what Description Possible values
"cursorOn" This allows to turn on/off cursor. "on"/"off"1 or 0
"cursorBlink" If cursor is on, then you can turn on/off its blinking. "blink"/"noblink"1 or 0
"lanType" Type of LAN connection. "ethernet", "wifi" or "none"
"ethernet" IP address set for ethernet connection. IP address format
"ethernetIP" IP address for ethernet connection. IP address format
"ethernetSubnetMask" Subnet mask for ethernet connection. IP address format
"wifi" IP address set for wifi connection. IP address format
"wifiSetting" Setting pins for wifi Value is a list of pins delimited by ; (see example)
"wifiSSID" SSID of wi-fi Arduino will try to connect to Maximal length is 100 characters
"wifiPassword" Password for given wi-fi network Maximal length is 100 characters
"MAC" MAC address for Arduino Each device on network has to have unique MAC address. Default value is: "A0-B1-C2-D3-E4-F5"
"ethernetMAC" MAC address for Arduino Each device on network has to have unique MAC address. Default value is: "A0-B1-C2-D3-E4-F5"
"lcdSetting" Allows to set pins for LCD Value is a list of pins delimited by ; (see example)
"lcdEnabled" Will start LCD on previously set pins Possible values: "disable" and "enable"1 or 0
"stepperSetting" Allows to set pins for Stepper Value is a list of pins delimited by ; (see example)
"stepperEnabled" Will startenable Stepper on previously set pins Possible values: "yes" and "no"1 or 0
"stepperVelocity" Set current velocity of stepper
"stepperMaxVelocity" Set maximum velocity of stepper
"stepperAcceleration" Set current acceleration of stepper
"stepperEngaged" Engage stepper 1 or 0
"stepperMode"Set stepper mode"step" (motor will move to given position) and "run" (continuos movement)
"pinSetting" Allows to set mode for given pin Possible values are: "digitalInput", "digitalOutput", "analogInput", "analogOutput", "internalPullUp","servo", "none".
"inlineDocumentation" Shows/hides inlineDocumentation in Plug-In. This selector doesn't work on FileMaker Server."on" or "off"

Result

Function returns value if everything is OK. In case of error the function returns "?". You can use Arduino_Get("lastError") for more detailed error description.

Examples

Arduino_Set( "lcdEnabled" ; "yes"1 ; "/dev/tty0")
This will enable LCD on Arduino (pins are defined by Arduino_Set("lcdSetting")) .

Arduino_Set( "lcdSetting" ; "RS=12;E=11;D4=5;D5=4;D6=63;D7=2" ; "COM3")
This will set pins for LCD display. If any of given pin is missing, it will be set to default value (default values are: "RS=12;E=11;D4=5;D5=4;D6=3;D7=2")

Arduino_Set( "lcdSetting" ; "" ; "COM3")
This will set pins for LCD display to default values. Default values are "RS=12;E=11;D4=5;D5=4;D6=3;D7=2".

Arduino_Set( "ethernet""ethernetIP" ; "192.168.0.1" ; "COM3")
This will set IP of Arduino to 192.168.0.1 for Ethernet interface. When Arduino is connected by Ethernet interface it will be using IP set by this command (no DHCP implemented)

Arduino_Set( "wifiSetting" ; "RX=3;TX=4")
This will set pin 3 on arduino uno for rx pin of esp8266esp-01 and pin 4 on tx pin of esp8266esp-01.

Arduino_Set( "wifiSSID" ; "networkSSID" ; "COM3")
This will store ssid name on Arduino.

Arduino_Set( "wifiPassword"; "password" ; "COM3")
This will store password for the wifi on Arduino.

Arduino_Set( "lanType"; "wifi" )
This will configure the esp8266esp-01 modul and connect it to the wifi. Before you configure modul, you have to set first pins, ssid and password.

Arduino_Set( "stepperSetting" ; "IN1=8;IN2=9;IN3=10;IN4=11")
This will set pins for the stepper.

Arduino_Set( "cursorOn" ; "1")
This will display the cursor on LCD.

Arduino_Set( "wifi""wifiSSID" ; "192.168.0.1""MyNetwork" ; "COM5") & " " & Arduino_Set( "ethernet" ; "192.168.0.2" ; "COM5") & " " & Arduino_Set( "lanType" ; "ethernet" ; "COM5")
This will set IP of Arduino wi-fi connection to 192.168.0.1SSID for wi-fi connection to "MyNetwork", IP of Arduino Ethernet connection to 192.168.0.2. Also this would set Arduino to start using Ethernet shield with Ethernet connection for connecting to local LAN. After Arduino restart, Arduino will still connect to LAN using ethernet.

Arduino_Reboot( connectionID )

Function to for rebooting Arduino (in order to load new settings). SAfter this function is called Arduino sends command for rebooting to Arduino, then it disconnects itself, wait for some time and tries to connect to Arduino over the same connection again.

Parameters

connectionIDArduino connection ID. More about connectionID is here.

Result

Function return 0, if everything OK, if function fails - it returns "?". You can use Arduino_Get("lastError") for more detailed error description.

Examples

Arduino_Reboot("10.0.3.51")
Disconnects Arduino on the address 10.0.3.51.

Arduino_Reboot("COM3")
Disconnects PlugInPlug-In from Arduino on COM3.

connectionID

Each Arduino is connected either by Ethernet cable, wi-fi or Serial port. PlugInPlug-In identifies each connected Arduino board by its connection type.
After connecting Arduino to your PC, you have to call Arduino_Connect and pass connectionID.

Connection type connectionID
Serial On your macOS you can find connected serial devices by opening Terminal and using command: "ls -l /dev | grep tty".
On your windows you have to use external application to get connected devices (or you can use Control Panel -> Hardware and Sound -> Devices and Printers)
Ethernet or wi-fi IP address of your Arduino. Wi-fi or Ethernet has to be first initialised and IP set. See command Arduino_Set("ethernet") and Arduino_Set("wifi")

Custom Script Steps

Since version 16 of FileMaker Pro and FileMaker Pro Advanced new feature called "External custom script steps" has been added. This feature allows plug-in to offer its functionality as FileMaker custom script steps. Following table shows, which functions of plug-in can be also called as custom script step.
Plug-In function Custom script Step
Arduino_Register Arduino Register
Arduino_Connect Arduino Connect
Arduino_Disconnect Arduino Disconnect
Arduino_Write Arduino Write
Arduino_Set Arduino Set
Arduino_SetScriptEvent Arduino Set Script Event
Arduino_Reboot Arduino Reboot

Troubleshooting

24U ConnectBridge for Arduino status codes

-2Wrong setting Pin doesn't support this setting.
-5Wrong pin Pins 0 and 1 are used for PlugInPlug-In communication.
-6Eeprom error EEPROM out of range.
-7Wrong connectionID Unable to reach Arduino using this connectionID.
-1Connection error Lost connection with arduino.
-4Not implemented This feature is not implemented.
-50Parameter Error Wrong parameters for function, please check plug-in syntax
-90Device Limit Limit of allowed devices has been met
-8 Serial port couldn't be opened
-9 Unable to get serial port options
-10 Unable to set serial port options
-11 Error setting serial port input speed
-12 Error setting serial port output speed
-13 Error setting serial port mode
-20Not connected Device with given connectionID not connected
-21Duplicate Device with given connectionID has been connected before
-22Invalid response Invalid response from Arduino
-23 Error reading from serial port
-24 You're trying to use function for Stepper without stepper being allowed
-25Stepper error Stepper init error, check if pins are allowed for Stepper.
-26LCD usage error You're trying to use function for LCD without LCD being allowed
-27LCD init error LCD init error, check if pins are allowed for LCD.
-28Pin setting error Pin you are trying to use is already used by other Arduino part.
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.