serial

available

Gets the current status of the serial port.

serial.available()

Returns the number of pending bytes in the serial port.

Close

Closes the serial port

serial.close()

Is writing

Gets the current writing status of the serial port.

serial.is_writing()

Returns a boolean of whether it is writing or not.

Open

Opens the serial port

serial.open(baudrate)

Input Parameters:

  • baudrate[int] = The desired baudrate of your serial port. Defaults to 115200. This is the standard baudrate used by Racelogic.

Read

Reads the data from the serial port.

serial.read(bytes_to_read)

Input Parameters

  • bytes_to_read[int] = amount of bytes to be read in. Usually set to be serial.available()

Set callback

Sets a callback function that is triggered every time there is new data in the serial port.

serial.set_callback(serial_cb)

Input Parameters:

  • serial_cb[func] = The function to be triggered whenever new serial data is received.

write

Writes data to the serial port

serial.write(data)

Input Parameters:

  • data[buffer protocol] = The data to be written to the serial port.