• VEXcode Robotics Logo VEX Robotics Logo
  • VEX API Home Button VEX API Home Button
  • VEX 123 logo in purple VEX 123 logo in white
  • VEX GO logo in lime green VEX GO logo in white
  • VEXcode AIM logo in blue VEXcode AIM logo in white
  • VEX IQ logo in blue VEX IQ logo in white
  • VEX EXP logo in red VEX EXP logo in white
  • VEX V5 logo in red VEX V5 logo in white
  • VEX CTE logo in green VEX CTE logo in white
  • VEXcode VR logo in gold VEXcode VR logo in white
Skip to main content
Ctrl+K

< Back to Platform Select

  • VEX V5
  • Python
  • SerialLink
  • VEXcode Robotics Logo

Section Navigation

  • Blocks
  • Switch
  • Python
    • Enums
    • Accelerometer
    • AddressableLed
    • AiVision
    • AnalogIn
    • Brain
    • Bumper
    • Color
    • Competition
    • Controller
    • DigitalIn
    • DigitalOut
    • Distance
    • DriveTrain
    • Electromagnet
    • Encoder
    • Event
    • Gps
    • Gyro
    • Inertial
    • Led
    • Light
    • Limit
    • Line
    • MessageLink
    • Motor
    • Motor55
    • Motor29
    • MotorGroup
    • MotorVictor
    • ObjectDetector
    • Optical
    • Pneumatic
    • Potentiometer
    • PotentiometerV2
    • Print Console
    • Pwm
    • Rotation
    • SerialLink
    • Servo
    • SmartDrive
    • Sonar
    • Thread
    • Timer
    • Triport
    • Vision
  • C++

Platform Navigation

  • VEX 123 logo in purple VEX 123 logo in white
  • VEX GO logo in lime green VEX GO logo in white
  • VEXcode AIM logo in blue VEXcode AIM logo in white
  • VEX IQ logo in blue VEX IQ logo in white
  • VEX EXP logo in red VEX EXP logo in white
  • VEX V5 logo in red VEX V5 logo in white
  • VEX CTE logo in green VEX CTE logo in white
  • VEXcode VR logo in gold VEXcode VR logo in white

SerialLink#

  • What is a Serial Link?

  • Initializing the SerialLink Class

  • Class Methods

    • is_linked()

    • send()

    • receive()

    • received()

    • installed()

What is a Serial Link?#

VEXlink enables an V5 Brain to communicate with another V5 Brain, allowing for point-to-point connections and the creation of communication meshes between multiple robots. It supports both wireless and wired communication, with wired connections recommending a modified smart cable to prevent power routing issues. For wireless communication, each robot needs a V5 Robot Radio connected to a Smart Port, and the VEXlink Radio can be used alongside a V5 Controller’s VEXnet radio, which should be connected to the highest numbered Smart Port to avoid conflicts.

The SerialLink class within VEXlink allows for a stream of data to be sent between robots, the contents of the stream needs to be understood by both the transmitting and receiving robot, this class is usually used as part of higher layer of software that encodes and decodes packets as necessary.

To create a VEXlink, both V5 Brains must be connected to a V5 Robot Radio.

Initializing the SerialLink Class#

A VEXlink is created by using the following constructor:

SerialLink(port, name, linktype, wired)

This constructor uses four parameters:

Parameter

Description

port

A valid Smart Port that the VEXlink Radio is connected to.

name

The name of this link. It is recommended that this unique string is long enough that when hashed by vexos it will create a unique ID. A bad link name would be something generic such as “vexlink” as it may be used by another team.

linktype

The type of link, either VexlinkType.MANAGER or VexlinkType.WORKER. This information is used to correctly configure the radio and also determines available bandwidth for transmission and reception. A manager robot has double the available bandwidth (1040 bytes/second) to send information to the worker robot (520 bytes/second).

wired

Optional. Whether or not it is a wired link. Set to True if wired.

# Construct a VEXlink "seriallink" with the SerialLink class.
seriallink = SerialLink(Ports.PORT1, "Link", VexlinkType.MANAGER)

This seriallink object will be used in all subsequent examples throughout this API documentation when referring to SerialLink class methods.

Class Methods#

is_linked()#

The is_linked() method returns the link status of the Serial Link.

Returns: True if the Serial Link is active and connected to the paired Brain. False if it is not.

send()#

The send() method sends a buffer through the Serial Link.

Parameters

Description

buffer

A string or bytearray. The message to send.

Returns: None.

# Send the string 'test'.
seriallink.send('test')

receive()#

The receive(length, timeout) method receives data from the Serial Link.

Parameters

Description

length

The maximum amount of data to wait for.

timeout

Optional. The timeout value in milliseconds before the function returns.

Returns: A bytearray with the received data or None if no data was received.

# Wait for 128 bytes of data for 1000mS.
buffer = seriallink.receive(128, 1000)

received()#

The received(callback) method registers a callback function for when data is received.

Parameters

Description

callback

The callback function to be called when data is received.

Returns: None.

# Define a function data_received()
def data_received():
    # The Brain will print that data was received by the 
    # Serial Link on the Brain's screen.
    Brain.screen.print("data received by Serial Link")

# Run data_received when data is received by the Serial Link.
seriallink.received(data_received)

installed()#

The installed() method checks if the Serial Link is connected.

Returns: True if the Serial Link is connected. False if it is not.

previous

Rotation

next

Servo

On this page
  • What is a Serial Link?
  • Initializing the SerialLink Class
  • Class Methods
    • is_linked()
    • send()
    • receive()
    • received()
    • installed()
Innovation First, International

VEX and VEX Robotics are trademarks or service marks of Innovation First, Inc. Copyright ©2025. All Rights Reserved. VEX Robotics, Inc. is a subsidiary of Innovation First International, Inc. All other product names / marks of others are the property of their respective owners. Patents and / or Patents Pending - innovationfirst.com/patents
Site Privacy Policy / Site Terms of Use / Cookie Policy / Software Privacy Policy

Visit the VEX Robotics Facebook Page Visit the VEX Robotics Twitter Page Visit the VEX Robotics Instagram Page Visit the VEX Robotics YouTube Page
VEX API Feedback Form

We value your feedback! Use this form to share suggestions, compliments, or report errors with the VEX API. Your input helps us enhance the VEX API documentation.

If you are experiencing technical issues or require customer support, please visit support.vex.com.

  • Send Happy Feedback
  • Send Sad Feedback

Note: the current URL will be shared with your message

By including your email address, you agree that VEX may send you email emails if we have questions about your feedback.
Privacy Policy >
Choose Which VEX IQ Generation to View

VEX IQ (1st gen)

VEX IQ (2nd gen)