• 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
  • VEX AIR logo in orange VEX AIR logo in white
  • VEXcode VR logo in gold VEXcode VR logo in white
跳至主要内容
Ctrl+K

< Back to Platform Select

  • VEX V5
  • 欢迎来到 VEX V5 的 API 参考网站
  • VEXlink
  • message_link
简体中文
  • English
  • Spanish
  • VEXcode Robotics Logo

版块导航

  • 区块
  • Python
  • C++
    • Drivetrain
    • Motion
    • Vision
    • Screen
    • Controller
    • Sensing
    • 惯性
    • 3-Wire Devices
    • Pneumatics
    • brain
    • SD Card
    • VEXlink
      • message_link
      • serial_link
    • Console
    • Logic
    • electromagnet
    • SD Card
    • 竞赛

平台导航

  • 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
  • VEX AIR logo in orange VEX AIR logo in white
  • VEXcode VR logo in gold VEXcode VR logo in white

message_link#

  • What is a Message Link?

  • Initializing the message_link Class

  • Class Methods

    • send()

    • receive()

    • received()

What is a Message Link?#

VEXlink enables a 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 message_link class within VEXlink facilitates sending simple messages, such as “play” and “stop,” with minimal data to the connected robot.

Initializing the message_link Class#

A VEXlink is created by using the following constructor:

The message_link constructor creates a message_link object in the specified Port, with the specified ID and linktype, and sets the wired flag to the specified value.

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 linkType.MANAGER or linkType.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

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

// Construct a VEXlink "link" with the message_link class.
message_link link = message_link(PORT1, "link", linkType::manager);

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

Class Methods#

send()#

This method is called in the following ways:

The send(message) method sends a message through the Message Link.

Parameters

Description

message

The message to send.

Returns: An integer representing the length of transmitted data.

// Send the message "test" with no parameters.
link.send("test");

The send(message, value) method sends a message through the Message Link.

Parameters

Description

message

The message to send.

value

An float representing the ID of the message.

Returns: An integer representing the length of transmitted data.

The send(message, index, value) method sends a message through the Message Link.

Parameters

Description

message

The message to send.

index

An integer representing the port the receiving Message Link is connected to.

value

An float representing the ID of the message.

Returns: An integer representing the length of transmitted data.

receive()#

The receive(timeout) command receives a message from the Message Link.

Parameters

Description

timeout

The timeout duration for receiving the message in milliseconds before the function returns.

Returns: The received message.

received()#

The received(callback) command registers a callback function for when a message is received. If the message is omitted then the callback function will be called for all messages.

This is a non-waiting command and allows the next command to run without delay.

Parameters

Description

callback

The callback function to be called when a message is received.

Returns: An instance of the event class.

上一页

VEXlink

下一页

serial_link

On this page
  • What is a Message Link?
  • Initializing the message_link Class
  • Class Methods
    • send()
    • receive()
    • received()
Innovation First, International

VEX 和 VEX Robotics 是 Innovation First, Inc. 的商标或服务标志 版权所有 ©2025。保留所有权利。VEX Robotics, Inc. 是 Innovation First International, Inc. 的子公司。所有其他产品名称/商标均为其各自所有者的财产。专利和/或正在申请的专利 - innovationfirst.com/patents
网站隐私政策 / 网站使用条款 / Cookie 政策 / 软件隐私政策

访问 VEX Robotics Facebook 页面 访问 VEX Robotics Twitter 页面 访问 VEX Robotics Instagram 页面 访问 VEX Robotics YouTube 页面
VEX API 反馈表

我们重视您的反馈!请使用此表单分享建议、赞美或报告 VEX API 的错误。您的反馈有助于我们完善 VEX API 文档。

如果您遇到技术问题或需要客户支持,请访问 support.vex.com.

  • Send Happy Feedback
  • Send Sad Feedback

注意:当前 URL 将与您的消息共享

通过添加您的电子邮件地址,您同意如果我们对您的反馈有疑问,VEX 可以向您发送电子邮件。
隐私政策 >
请提供您的反馈。 反馈提交成功!
Choose Which VEX IQ Generation to View

VEX IQ (1st gen)

VEX IQ (2nd gen)