--- title: "system.serial.write" description: "Write a String to a serial port using the platforms default character encoding." --- # system.serial.write > Write a String to a serial port using the platforms default character encoding. This function is used in **Python Scripting**. ## Description ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax `system.serial.write(port, toWrite, [timeout], [encoding])` ### Parameters Type | Parameter | Description ------- | ------- | ------ String| `port` | The previously configured serial port to use. String| `toWrite` | The String to write. Integer| `timeout` | A timeout, in milliseconds. Writes exceeding this period will . Defaults to 5000 [optional] String| `encoding` |Encoding to decode the string with, for example: UTF-8. Default is the platform default character set. [optional] ### Returns Nothing ### Scope Gateway, Vision Client, Perspective Session ## The encoding Parameter The encoding parameter can be used to decode a string with any of the possible encoding character sets that are available. By default, the following character sets are provided by the [Java platform](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/charset/StandardCharsets.html) (dash characters and underscores are interchangeable). Dashed examples are shown below: * ISO-8859-1 * US-ASCII * UTF-16 * UTF-16BE * UTF-16LE * UTF-8 ## Code Example ```python title="Code Snippet" # This example will write a string to a port called "COM1". port = "COM1" toWrite = "I am a string" system.serial.write(port,toWrite) ```