Class

# SerialDevice

<div class="rst-class">

forsearch

</div>

Serial

<div class="rst-class">

forsearch

</div>

SerialDevice

<div class="rst-class">

forsearch

</div>

Hardware

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to access serial devices.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                              | Type                               | Read-Only | Shared |
|---------------------------------------------------|------------------------------------|-----------|--------|
| `Count<serialdevice.count>`                       | `Integer</api/data_types/integer>` | ✓         | ✓      |
| `InputDriverName<serialdevice.inputdrivername>`   | `String</api/data_types/string>`   | ✓         |        |
| `LastIndex<serialdevice.lastindex>`               | `Integer</api/data_types/integer>` | ✓         | ✓      |
| `MaximumSpeed<serialdevice.maximumspeed>`         | `Integer</api/data_types/integer>` | ✓         |        |
| `Name<serialdevice.name>`                         | `String</api/data_types/string>`   | ✓         |        |
| `OutputDriverName<serialdevice.outputdrivername>` | `String</api/data_types/string>`   | ✓         |        |
| `RatedSpeed<serialdevice.ratedspeed>`             | `Integer</api/data_types/integer>` | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                              | Parameters                                  | Returns      | Shared |
|-----------------------------------|---------------------------------------------|--------------|--------|
| `At<serialdevice.at>`             | index As `Integer</api/data_types/integer>` | SerialDevice | ✓      |
| `WithName<serialdevice.withname>` | name As `String</api/data_types/string>`    | SerialDevice | ✓      |

## Property descriptions

<div id="serialdevice.count">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.Count

**Count** As `Integer</api/data_types/integer>`

> Returns the number of serial devices available.
>
> This property is read-only.
>
> This property is `shared</api/language/shared>`.
>
> The following displays the names of the serial devices on the computer:
>
> ``` xojo
> For i As Integer = 0 To SerialDevice.LastIndex
> MessageBox(SerialDevice.At(i).Name)
> Next
> ```

<div id="serialdevice.inputdrivername">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.InputDriverName

**InputDriverName** As `String</api/data_types/string>`

> The name of the input driver.
>
> This property is read-only.
>
> This example gets the name of serial device 0.
>
> ``` xojo
> TextField1.Text = SerialDevice.At(0).InputDriverName
> ```

<div id="serialdevice.lastindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.LastIndex

**LastIndex** As `Integer</api/data_types/integer>`

> Returns the index of the last serial device.
>
> This property is read-only.
>
> This property is `shared</api/language/shared>`.
>
> The following displays the names of the serial devices on the computer:
>
> ``` xojo
> For i As Integer = 0 To SerialDevice.LastIndex
> MessageBox(SerialDevice.At(i).Name)
> Next
> ```

<div id="serialdevice.maximumspeed">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.MaximumSpeed

**MaximumSpeed** As `Integer</api/data_types/integer>`

> The maximum speed (baud) at which you can communicate with the device.
>
> This property is read-only.
>
> This example reads the maximum speed of the serial device at index 0.
>
> ``` xojo
> TextField1.Text = SerialDevice.At(0).MaximumSpeed.ToString
> ```

<div id="serialdevice.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.Name

**Name** As `String</api/data_types/string>`

> The name of the serial device.
>
> This property is read-only.
>
> This example gets the name of serial device at index 0.
>
> ``` xojo
> TextField1.Text = SerialDevice.At(0).Name
> ```

<div id="serialdevice.outputdrivername">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.OutputDriverName

**OutputDriverName** As `String</api/data_types/string>`

> The name of the output driver.
>
> This property is read-only.
>
> This example gets the name of the output drive for the serial device at index 0.
>
> ``` xojo
> TextField1.Text = SerialDevice.At(0).OutputDriverName
> ```

<div id="serialdevice.ratedspeed">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.RatedSpeed

**RatedSpeed** As `Integer</api/data_types/integer>`

> The rated speed (baud) at which you can communicate with the serial device.
>
> This property is read-only.
>
> This example reads the rated speed of the serial device at index 0.
>
> ``` xojo
> TextField1.Text = SerialDevice.At(0).RatedSpeed.ToString
> ```

## Method descriptions

<div id="serialdevice.at">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.At

**At**(index As `Integer</api/data_types/integer>`) As SerialDevice

> Gets the serial device by its index.
>
> This method is `shared</api/language/shared>`.
>
> ``` xojo
> TextField1.Text = SerialDevice.At(0).InputDriverName
> ```
>
> The following displays the names of the serial devices on the computer:
>
> ``` xojo
> For i As Integer = 0 To SerialDevice.LastIndex
> MessageBox(SerialDevice.At(i).Name)
> Next
> ```

<div id="serialdevice.withname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

SerialDevice.WithName

**WithName**(name As `String</api/data_types/string>`) As SerialDevice

> Gets the serial device by its *name*.
>
> This method is `shared</api/language/shared>`.
>
> If you're unsure what the names of the various serial devices are, you can loop through them to get the names. See the example below.
>
> The following displays the names of the serial devices on the computer:
>
> ``` xojo
> For i As Integer = 0 To SerialDevice.LastIndex
> MessageBox(SerialDevice.At(i).InputDriverName)
> Next
> ```

## Compatibility

|                       |                       |
|-----------------------|-----------------------|
| **Project Types**     | Console, Desktop, Web |
| **Operating Systems** | All                   |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `SerialConnection</api/hardware/serialconnection>` class, `Connecting To A Serial Device</getting_started/tutorials/connecting_to_a_serial_device>`

</div>
