Skip to content

Scripting API / core/serial/SerialConnectionApi

core/serial/SerialConnectionApi

Modules

Module Description
External -

Classes

SerialConnectionApi

Methods

clearBuffer()

clearBuffer(): Promise<void>

Clears the read buffer

Returns

Promise<void>

disconnect()

disconnect(): Promise<void>

Disconnects and closes the connection

Returns

Promise<void>

readAll()

readAll(): Promise<string[]>

Returns an array of strings of all readings in the buffer. The buffer starts to be populated when the connection is opened. The read buffer is reset each time readAll() or clearBuffer() is called.

Returns

Promise<string[]>

readNext()

readNext(preReadCommand?, postReadCommand?): Promise<string>

Returns the next reading received by the serial connection.

Parameters
Parameter Type Description
preReadCommand? string Command to send to the connection before taking a reading
postReadCommand? string Command to send to the connection after taking a reading
Returns

Promise<string>

write()

write(command): Promise<void>

Writes a command to the connection

Parameters
Parameter Type
command string
Returns

Promise<void>