• 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 EXP
  • VEX EXP API संदर्भ
  • VEXlink
  • संदेश लिंक
हिंदी
  • English
  • العربية
  • বাংলা
  • Česky
  • Deutsch
  • Ελληνικά
  • Español
  • Español Latinoamericano
  • Suomi
  • Français
  • Gaeilge
  • Magyar
  • Bahasa Indonesia
  • 日本語
  • 한국어
  • Lietuvių
  • Latviešu
  • മലയാളം
  • Nederlands
  • Polski
  • Português
  • Русский
  • Svenska
  • ไทย
  • Türkçe
  • Українська
  • Tiếng Việt
  • 简体中文
  • 繁體中文
  • VEXcode Robotics Logo

अनुभाग नेविगेशन

  • ब्लाकों
  • Python
  • C++
    • ड्राइवट्रेन
    • मोटर और मोटर नियंत्रक
    • 3-तार वाले उपकरण
    • दिमाग
    • सांत्वना देना
    • नियंत्रक
    • तर्क
    • स्मार्ट पोर्ट डिवाइस
    • VEXlink
      • संदेश लिंक
      • सीरियल लिंक
    • सीटीई वर्कसेल
  • VEXcode ट्यूटोरियल

प्लेटफ़ॉर्म नेविगेशन

  • 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

संदेश लिंक#

  • परिचय

  • क्लास कंस्ट्रक्टर

  • क्लास डिस्ट्रक्टर

  • पैरामीटर

  • उदाहरण

  • सदस्य कार्य

    • isLinked

    • भेजना

    • प्राप्त करें

    • प्राप्त

परिचय#

message_link क्लास दो EXP ब्रेन को छोटे स्ट्रिंग संदेश भेजकर संवाद करने की अनुमति देती है, जिसमें वैकल्पिक रूप से छोटा डेटा भी शामिल हो सकता है। इसे रोबोट-टू-रोबोट समन्वय के लिए डिज़ाइन किया गया है — जैसे कि रूटीन शुरू करना, सेंसर के परिणाम साझा करना या किसी अन्य रोबोट पर व्यवहार को सक्रिय करना।

send के प्रत्येक उपयोग से लिंक्ड EXP ब्रेन की कतार में एक संदेश जुड़ जाता है, और कतार को पहले आओ, पहले जाओ (FIFO) के आधार पर पढ़ा जाता है। यदि दूसरे EXP ब्रेन द्वारा receive का उपयोग करने से पहले कई संदेश भेजे जाते हैं, तो उन्हें संग्रहीत किया जाएगा और भेजे जाने के क्रम में एक-एक करके वापस किया जाएगा। क्योंकि संदेश कतार में लग सकते हैं, प्रत्येक लूप में एक ही स्थिति को बार-बार भेजने से बैकलॉग बन सकता है; समय-संवेदनशील लॉजिक के लिए, केवल तभी भेजें जब मान बदलते हों।

महत्वपूर्ण: दोनों रोबोटों को एक ही समय में ऐसे प्रोजेक्ट चलाने होंगे जो message_link का उपयोग करते हों, अन्यथा कोई संदेश भेजा/प्राप्त नहीं किया जाएगा।

क्लास कंस्ट्रक्टर#

message_link( 
  int32_t     index, 
  const char  *name, 
  linkType    type, 
  bool        isWired = false );

क्लास डिस्ट्रक्टर#

message_link ऑब्जेक्ट को नष्ट करता है और उससे जुड़े संसाधनों को मुक्त करता है।

virtual ~message_link();

पैरामीटर#

पैरामीटर

प्रकार

विवरण

index

int32_t

स्मार्ट पोर्ट जिससे वी5 रेडियो या स्मार्ट केबल जुड़ा हुआ है, उसे PORTxके रूप में लिखा जाता है, जहां x पोर्ट संख्या है (उदाहरण के लिए, PORT1)।

name

char

संदेश लिंक का नाम।

type

linkType

लिंक का प्रकार, या तो linkType::manager या linkType::workerइस जानकारी का उपयोग रेडियो को सही ढंग से कॉन्फ़िगर करने के लिए किया जाता है और साथ ही ट्रांसमिशन और रिसेप्शन के लिए उपलब्ध बैंडविड्थ को भी निर्धारित करता है। एक मैनेजर रोबोट के पास वर्कर रोबोट (520 बाइट्स/सेकंड) को जानकारी भेजने के लिए उपलब्ध बैंडविड्थ (1040 बाइट्स/सेकंड) से दोगुनी बैंडविड्थ होती है।

  • linkType::manager - message_link ऑब्जेक्ट एक मैनेजर है।
  • linkType::worker - message_link ऑब्जेक्ट एक वर्कर है।

isWired

bool

क्या message_link ऑब्जेक्ट वायर्ड है?

  • true - message_link ऑब्जेक्ट वायर्ड है।
  • false - message_link ऑब्जेक्ट वायरलेस है।

उदाहरण#

रोबोट 1 का कोड

// Create a wireless link in Port 1
message_link link = message_link(
  PORT1, // index
  "VEXRoboticsLink123456789", // name
  linkType::manager, // type
  true); // isWired

रोबोट 2 के लिए कोड

// Create a wireless link in Port 1
message_link link = message_link(
  PORT1, // index
  "VEXRoboticsLink123456789", // name
  linkType::worker, // type
  true); // isWired

सदस्य कार्य#

message_link क्लास में निम्नलिखित सदस्य फ़ंक्शन शामिल हैं:

  • isLinked — यह बताता है कि क्या यह ब्रेन अपने युग्मित ब्रेन से सक्रिय रूप से जुड़ा हुआ है।

  • send — युग्मित मस्तिष्क को एक संदेश भेजता है।

  • receive — अगले आने वाले संदेश की प्रतीक्षा करता है और उसे लौटाता है।

  • received — जब भी कोई नया संदेश प्राप्त होता है, तो कॉल करने के लिए एक फ़ंक्शन पंजीकृत करता है।

किसी भी message_link सदस्य फ़ंक्शन को कॉल करने से पहले, एक message_link इंस्टेंस बनाना आवश्यक है, जैसा कि नीचे दिखाया गया है:

रोबोट 1 का कोड

// Create a wireless link in Port 1
message_link link = message_link(
  PORT1, // index
  "VEXRoboticsLink123456789", // name
  linkType::manager, // type
  true); // isWired

रोबोट 2 के लिए कोड

// Create a wireless link in Port 1
message_link link = message_link(
  PORT1, // index
  "VEXRoboticsLink123456789", // name
  linkType::worker, // type
  true); // isWired

isLinked#

isLinked विधि यह लौटाती है कि क्या MessageLink पर EXP Brains एक दूसरे के साथ युग्मित हैं।

Available Functions
bool isLinked();

Parameters

इस फ़ंक्शन में कोई पैरामीटर नहीं है।

Return Values

यह फ़ंक्शन एक बूलियन मान लौटाता है।

  • true – दोनों EXP ब्रेन इस लिंक पर युग्मित और संचार कर रहे हैं।

  • false – इस लिंक पर दो EXP ब्रेन युग्मित नहीं हैं।

Notes

किसी भी प्रोजेक्ट को शुरू करने से पहले, आगे कोई भी कोड चलाने से पहले, यह सुनिश्चित करने के लिए हमेशा जांच करना एक अच्छी प्रथा है कि EXP Brains लिंक किए गए हैं।

Examples

रोबोट 1 का कोड

// Tell the other robot when the screen is being pressed
  // Create the link
  message_link link = message_link(PORT1, "VEXRoboticsLink123456789", linkType::manager, true);

  // Do not run code UNTIL the Brains are linked
  while (!link.isLinked()){
    wait(0.1, seconds);
  }

  Brain.Screen.print("Robot 1 - Manager");

  // Continuously send if the screen is being pressed
  while (true){
    if (Brain.Screen.pressing()){
      link.send("pressed");
    } else {
      link.send("released");
    }
    wait(0.05, seconds);
  }

रोबोट 2 के लिए कोड

// Display if the other robot's screen is being pressed

  // Create the link
  message_link link = message_link(PORT1, "VEXRoboticsLink123456789", linkType::worker, true);
  
  // Do not run code UNTIL the Brains are linked
  while (!link.isLinked()){
   wait(0.1, seconds);
  }

  // Continuously check if Robot 1 has sent "pressed"
  while (true){
    Brain.Screen.clearScreen();
    Brain.Screen.setCursor(1, 1);
    Brain.Screen.print("Robot 2 - Worker");
    Brain.Screen.newLine();
    char msg[32] = {0};                         // buffer for incoming message
    int32_t n = link.receive(msg, sizeof(msg), 100);  // wait up to 100ms
    if (n > 0 && strcmp(msg, "pressed") == 0) {
      Brain.Screen.newLine();
      Brain.Screen.print("Manager is being pressed!");
    }
    wait(0.05, seconds);
  }

send#

लिंक कनेक्शन के माध्यम से एक संदेश भेजता है।

Available Functions

1 — एक संदेश स्ट्रिंग भेजता है।

int32_t send( 
  const char *message );

2 — double के साथ एक संदेश स्ट्रिंग भेजता है।

int32_t send( 
  const char *message, 
  double      value );

3 — int32_t और double के साथ एक संदेश स्ट्रिंग भेजता है।

int32_t send(
  const char *message, 
  int32_t     index, 
  double      value );

Parameters

पैरामीटर

प्रकार

विवरण

message

const char*

दूसरे लिंक किए गए EXP ब्रेन को भेजा जाने वाला संदेश।

index

int32_t

एक पूर्णांक जिसे दूसरे लिंक किए गए EXP ब्रेन को भेजा जाना है।

value

double

दूसरे लिंक किए गए EXP ब्रेन को भेजने के लिए एक डबल मान। डबल मान 4 दशमलव स्थानों तक स्वरूपित होते हैं; यदि कम दशमलव स्थान दिए गए हैं, तो 4 दशमलव स्थान दिखने तक अंत में शून्य जोड़े जाते हैं।

Return Values

यह फ़ंक्शन कोई मान वापस नहीं करता है।

Notes

यदि केवल message भेजा जाता है, तो दूसरा लिंक किया गया EXP ब्रेन ठीक वही संदेश प्राप्त करता है।

यदि value (और index यदि प्रदान किया गया हो) शामिल हैं, तो प्राप्तकर्ता ब्रेन को एक एकल एन्कोडेड संदेश प्राप्त होता है जो सभी फ़ील्ड को इस क्रम में संयोजित करता है: .message_index_value

Examples

link.send(“string”, 1, 2.55) .string_1_2.5500 के रूप में प्राप्त किया जाता है।

रोबोट 1 का कोड

// Tell the other robot when the screen is being pressed

// Create the link
message_link link = message_link(PORT1, "VEXRoboticsLink123456789", linkType::manager, true);

// Do not run code UNTIL the Brains are linked
while (!link.isLinked()){
  wait(0.1, seconds);
}

Brain.Screen.print("Robot 1 - Manager");

// Continuously send if the screen is being pressed
while (true){
  if (Brain.Screen.pressing()){
    link.send("pressed");
  } else {
    link.send("released");
  }
  wait(0.05, seconds);
}

रोबोट 2 के लिए कोड

// Display if the other robot's screen is being pressed

// Create the link
message_link link = message_link(PORT1, "VEXRoboticsLink123456789", linkType::worker, true);

// Do not run code UNTIL the Brains are linked
while (!link.isLinked()){
  wait(0.1, seconds);
}
// Continuously check if Robot 1 has sent "pressed"
while (true){
  Brain.Screen.clearScreen();
  Brain.Screen.setCursor(1, 1);
  Brain.Screen.print("Robot 2 - Worker");
  Brain.Screen.newLine();
  char msg[32] = {0};  // buffer for incoming message
  int32_t n = link.receive(msg, sizeof(msg), 100);  // wait up to 100ms
  if (n > 0 && strcmp(msg, "pressed") == 0) {
    Brain.Screen.newLine();
    Brain.Screen.print("Manager is being pressed!");
  }
  wait(0.05, seconds);
}

receive#

लिंक कनेक्शन से एक संदेश प्राप्त होता है।

Available Functions
int32_t receive(
  char     *buffer,
  int32_t   length, 
  int32_t   timeoutMs = 500 );

Parameters

पैरामीटर

प्रकार

विवरण

buffer

char

प्राप्त संदेश को संग्रहित करने के लिए बफर।

length

int32_t

बफर की लंबाई।

timeoutMs

int32_t

मिलीसेकंड में कितना समय लगेगा receive केवल तभी नए संदेश की प्रतीक्षा करेगा जब कतार खाली हो। डिफ़ॉल्ट मान 300,000 (300 सेकंड) है।

Return Values

यह फ़ंक्शन प्राप्त बाइट्स की संख्या लौटाता है।

Notes
  • receive दूसरे लिंक्ड EXP ब्रेन से अगला क्यूड मैसेज लौटाता है। मैसेज FIFO क्रम में पढ़े जाते हैं (सबसे पुराना अपठित पहले)। यदि receive कॉल किए जाने पर क्यू खाली है, तो यह निर्दिष्ट timeout तक नए मैसेज की प्रतीक्षा करता है। यदि उस समय सीमा में कोई मैसेज नहीं आता है, तो receive 0लौटाता है, और उसके बाद भेजे गए कोई भी मैसेज अगली बार receive उपयोग किए जाने पर पढ़ने के लिए क्यू में बने रहते हैं।

  • यदि दूसरे लिंक्ड EXP ब्रेन ने केवल string, receive को भेजा तो वही सटीक स्ट्रिंग वापस मिलती है।

  • यदि दूसरे लिंक्ड EXP ब्रेन ने एक पूर्णांक और/या फ्लोट भेजा, तो receive एक एकल एन्कोडेड स्ट्रिंग लौटाता है जो सभी फ़ील्ड को इस क्रम में जोड़ता है: .string_integer_float

    • उदाहरण के लिए, यदि दूसरा लिंक्ड EXP ब्रेन link.send(“string”, 1, 2.55)का उपयोग करता है, तो link.receive() का उपयोग करने पर .string_1_2.5500जैसी एन्कोडेड स्ट्रिंग प्राप्त होती है। आप इस एन्कोडेड स्ट्रिंग को विभाजित कर सकते हैं (नीचे दिए गए उदाहरण देखें) ताकि संदेश का नाम, पूर्णांक और फ्लोट मान निकाले जा सकें।

    • अगर आप मैन्युअल विभाजन/पार्सिंग से बचना चाहते हैं, तो किसी विशिष्ट संदेश नाम के लिए हैंडलर को पंजीकृत करने के लिए received का उपयोग करें; हैंडलर भेजे गए मानों को तर्क के रूप में प्राप्त करता है।

Examples

link.send(“string”, 1, 2.55) .string_1_2.5500 के रूप में प्राप्त किया जाता है।

रोबोट 1 का कोड

// Tell the other robot when the screen is being pressed

// Create the link
message_link link = message_link(PORT1, "VEXRoboticsLink123456789", linkType::manager, true);

// Do not run code UNTIL the Brains are linked
while (!link.isLinked()){
  wait(0.1, seconds);
}

Brain.Screen.print("Robot 1 - Manager");

// Continuously send if the screen is being pressed
while (true){
  if (Brain.Screen.pressing()){
    link.send("pressed");
  } else {
    link.send("released");
  }
  wait(0.05, seconds);
}

रोबोट 2 के लिए कोड

// Display if the other robot's screen is being pressed

// Create the link
message_link link = message_link(PORT1, "VEXRoboticsLink123456789", linkType::worker, true);

// Do not run code UNTIL the Brains are linked
while (!link.isLinked()){
  wait(0.1, seconds);
}
// Continuously check if Robot 1 has sent "pressed"
while (true){
  Brain.Screen.clearScreen();
  Brain.Screen.setCursor(1, 1);
  Brain.Screen.print("Robot 2 - Worker");
  Brain.Screen.newLine();
  char msg[32] = {0};   // buffer for incoming message
  int32_t n = link.receive(msg, sizeof(msg), 100);  // wait up to 100ms
  if (n > 0 && strcmp(msg, "pressed") == 0) {
    Brain.Screen.newLine();
    Brain.Screen.print("Manager is being pressed!");
  }
  wait(0.05, seconds);
}

received#

EXP ब्रेन द्वारा भेजा गया संदेश प्राप्त होने पर कॉल किए जाने वाले फ़ंक्शन को पंजीकृत करता है।

Available Functions

1 सभी प्राप्त संदेशों (संदेश + मान) के लिए एक कॉलबैक पंजीकृत करता है।

void received(
    void (* callback)(const char *, const char *, double)
);

2 सभी प्राप्त संदेशों (संदेश + सूचकांक + मान) के लिए एक कॉलबैक पंजीकृत करता है।

void received(
    void (* callback)(const char *, const char *, int32_t, double)
);

3 किसी विशिष्ट संदेश (संदेश + मान) के लिए कॉलबैक पंजीकृत करता है।

void received(
    const char *message,
    void      (* callback)(const char *, const char *, double)
);

4 किसी विशिष्ट संदेश (संदेश + सूचकांक + मान) के लिए कॉलबैक पंजीकृत करता है।

void received(
    const char *message,
    void      (* callback)(const char *, const char *, int32_t, double)
);

Parameters

पैरामीटर

प्रकार

विवरण

message

const char *

जिस संदेश का नाम सुनना है। यदि इसे छोड़ दिया जाता है, तो कॉलबैक सभी प्राप्त संदेशों के लिए चलता है।

callback

फ़ंक्शन पॉइंटर

एक फ़ंक्शन जो संदेश प्राप्त होने पर निष्पादित होता है।

Return Values

यह फ़ंक्शन कोई मान वापस नहीं करता है।

Callback Signature

1 प्रेषक का नाम, संदेश का नाम और मान प्राप्त करता है।

void callback(const char *, const char *, double)

2 प्रेषक का नाम, संदेश का नाम, अनुक्रमणिका और मान प्राप्त करता है।

void callback(const char *, const char *, int32_t, double)

प्रकार

विवरण

1st const char *

प्रेषक लिंक का नाम।

2nd const char *

प्राप्त संदेश का नाम।

int32_t

संदेश से संबंधित सूचकांक।

double

संदेश से जुड़ा मान।

Examples

रोबोट 1 का कोड

// Send whether screen is pressed on left or right
void screen_pressed() {
  if (Brain.Screen.xPosition() < 240) {
    link.send("left");
  } else {
    link.send("right");
  }
}

int main() {
  /* vexcodeInit() is only required when using VEXcode.
  Remove vexcodeInit() if compiling in VS Code. */
  vexcodeInit();
  
// Create the link
  message_link link(PORT1, "LeftRightLink", linkType::manager, true);

// Do not run code UNTIL the Brains are linked
  while (!link.isLinked()) {
    wait(0.1, seconds);
  }

  Brain.Screen.print("Robot 1 - Manager");

  Brain.Screen.pressed(screen_pressed);

  while (true) {
    wait(10, msec);
  }
}

रोबोट 2 के लिए कोड

// Create variable to track where screen is pressed
int lastPress = 0;

// Update the variable whenever a new message is received
void message_received(const char* message, const char* linkname, double timestamp) {
  if (strcmp(message, "left") == 0)  lastPress = 1;
  if (strcmp(message, "right") == 0) lastPress = 2;
}

int main() {
  /* vexcodeInit() is only required when using VEXcode.
  Remove vexcodeInit() if compiling in VS Code. */
  vexcodeInit();

// Create the link
  message_link link(PORT1, "VEXRoboticsLink123456789", linkType::worker, true);

// Do not run code UNTIL the Brains are linked
  while (!link.isLinked()) {
    wait(0.1, seconds);
  }

  link.received(message_received);

  // Display if Robot 1's screen was pressed on the left or right
  while (true) {
    Brain.Screen.clearScreen();
    Brain.Screen.setCursor(1, 1);
    Brain.Screen.print("Robot 2 - Worker");
    Brain.Screen.newLine();

    if (lastPress == 1) {
      Brain.Screen.print("Manager pressed LEFT");
    } else if (lastPress == 2) {
      Brain.Screen.print("Manager pressed RIGHT");
    } else {
      Brain.Screen.print("Waiting...");
    }

    wait(0.1, seconds);
  }
}

पूर्ववर्ती

VEXlink

आगामी

सीरियल लिंक

On this page
  • परिचय
  • क्लास कंस्ट्रक्टर
  • क्लास डिस्ट्रक्टर
  • पैरामीटर
  • उदाहरण
  • सदस्य कार्य
    • isLinked
    • send
    • receive
    • received
Innovation First, International

VEX and VEX Robotics are trademarks or service marks of Innovation First, Inc. Copyright ©2026. 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

VEX रोबोटिक्स के फेसबुक पेज पर जाएं VEX रोबोटिक्स के ट्विटर पेज पर जाएं VEX रोबोटिक्स के इंस्टाग्राम पेज पर जाएं VEX रोबोटिक्स के 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)