• 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 റഫറൻസ്
  • VEXലിങ്ക്
  • സീരിയൽ ലിങ്ക്
മലയാളം
  • 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-വയർ ഉപകരണങ്ങൾ
    • തലച്ചോറ്
    • കൺസോൾ
    • കൺട്രോളർ
    • ലോജിക്
    • സ്മാർട്ട് പോർട്ട് ഉപകരണങ്ങൾ
    • VEXലിങ്ക്
      • സന്ദേശ ലിങ്ക്
      • സീരിയൽ ലിങ്ക്
    • സിടിഇ വർക്ക്സെൽ
  • 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

സീരിയൽ ലിങ്ക്#

  • ആമുഖം

  • ക്ലാസ് കൺസ്ട്രക്‌ടറുകൾ

  • ക്ലാസ് ഡിസ്ട്രക്റ്റർ

  • പാരാമീറ്ററുകൾ

  • കുറിപ്പുകൾ

  • ഉദാഹരണം

  • അംഗ പ്രവർത്തനങ്ങൾ

    • ലിങ്ക് ചെയ്‌തിരിക്കുന്നു

    • അയയ്ക്കുക

    • സ്വീകരിക്കുക

    • ലഭിച്ചു

ആമുഖം#

serial_link ക്ലാസ് റോബോട്ടുകൾക്കിടയിൽ റോ ബൈറ്റുകളുടെ ഒരു സ്ട്രീം അയയ്ക്കാൻ അനുവദിക്കുന്നു. റോബോട്ട്-ടു-റോബോട്ട് ആശയവിനിമയത്തിനായി ഇത് രൂപകൽപ്പന ചെയ്‌തിരിക്കുന്നു, അവിടെ ട്രാൻസ്മിറ്റിംഗ് ചെയ്യുന്നതും സ്വീകരിക്കുന്നതുമായ റോബോട്ട് ഡാറ്റ സ്ട്രീമിന്റെ ഉള്ളടക്കം മനസ്സിലാക്കുന്നു.

send ന്റെ ഓരോ ഉപയോഗവും ലിങ്ക് ചെയ്‌ത EXP ബ്രെയിനിന്റെ ക്യൂവിലേക്ക് ഡാറ്റ ചേർക്കുന്നു, കൂടാതെ ക്യൂ ആദ്യം വായിക്കുകയും ആദ്യം വായിക്കുകയും ചെയ്യുന്നു (FIFO). മറ്റ് EXP ബ്രെയിൻ ഉപയോഗങ്ങൾക്ക് ലഭിക്കുന്നതിന് മുമ്പ് ഒന്നിലധികം സന്ദേശങ്ങൾ അയച്ചാൽ, അവ സംഭരിക്കപ്പെടുകയും അവ അയച്ച ക്രമത്തിൽ ഓരോന്നായി തിരികെ നൽകുകയും ചെയ്യും. സന്ദേശങ്ങൾക്ക് ക്യൂ ചെയ്യാൻ കഴിയുന്നതിനാൽ, ഓരോ ലൂപ്പിലും ഒരേ സ്റ്റാറ്റസ് ആവർത്തിച്ച് അയയ്ക്കുന്നത് ബാക്ക്‌ലോഗ് സൃഷ്ടിച്ചേക്കാം; സമയ-നിർണ്ണായക യുക്തിക്ക്, മൂല്യങ്ങൾ മാറുമ്പോൾ മാത്രം അയയ്ക്കുക.

പ്രധാനം: രണ്ട് റോബോട്ടുകളും ഒരേ സമയം serial_link ഉപയോഗിക്കുന്ന പ്രോജക്ടുകൾ പ്രവർത്തിപ്പിക്കുന്നുണ്ടാകണം, അല്ലെങ്കിൽ ഡാറ്റയൊന്നും അയയ്ക്കുകയോ സ്വീകരിക്കുകയോ ചെയ്യില്ല.

ക്ലാസ് കൺസ്ട്രക്‌ടറുകൾ#

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

ക്ലാസ് ഡിസ്ട്രക്റ്റർ#

serial_link ഒബ്‌ജക്റ്റ് നശിപ്പിക്കുകയും അനുബന്ധ ഉറവിടങ്ങൾ പുറത്തുവിടുകയും ചെയ്യുന്നു.

~serial_link();

പാരാമീറ്ററുകൾ#

പാരാമീറ്റർ

ടൈപ്പ് ചെയ്യുക

വിവരണം

index

int32_t

സന്ദേശ ലിങ്ക് ബന്ധിപ്പിച്ചിരിക്കുന്ന സ്മാർട്ട് പോർട്ട്, PORTxഎന്ന് എഴുതപ്പെടുന്നു, ഇവിടെ x എന്നത് പോർട്ട് നമ്പറാണ് (ഉദാഹരണത്തിന്, PORT1).

name

const char*

ഈ ലിങ്കിന്റെ പേര്. ഈ അദ്വിതീയ സ്ട്രിംഗ് വെക്സോസ് ഹാഷ് ചെയ്യുമ്പോൾ ഒരു അദ്വിതീയ ഐഡി സൃഷ്ടിക്കുന്ന തരത്തിൽ നീളമുള്ളതായിരിക്കണമെന്ന് ശുപാർശ ചെയ്യുന്നു. ഒരു മോശം ലിങ്ക് നാമം “വെക്സ്ലിങ്ക്” പോലുള്ള പൊതുവായ ഒന്നായിരിക്കും, കാരണം അത് മറ്റൊരു ടീം ഉപയോഗിച്ചേക്കാം.

type

linkType

ലിങ്കിന്റെ തരം, ഒന്നുകിൽ linkType::manager അല്ലെങ്കിൽ linkType::workerറേഡിയോ ശരിയായി കോൺഫിഗർ ചെയ്യാൻ ഈ വിവരങ്ങൾ ഉപയോഗിക്കുന്നു, കൂടാതെ ട്രാൻസ്മിഷനും സ്വീകരണത്തിനും ലഭ്യമായ ബാൻഡ്‌വിഡ്ത്ത് നിർണ്ണയിക്കുന്നു. വർക്കർ റോബോട്ടിന് വിവരങ്ങൾ അയയ്ക്കാൻ ഒരു മാനേജർ റോബോട്ടിന് ലഭ്യമായ ബാൻഡ്‌വിഡ്ത്തിന്റെ ഇരട്ടി (1040 ബൈറ്റുകൾ/സെക്കൻഡ്) ഉണ്ട് (520 ബൈറ്റുകൾ/സെക്കൻഡ്).

  • linkType::manager — സീരിയൽ_ലിങ്ക് ഒബ്‌ജക്റ്റ് ഒരു മാനേജരാണ്
  • linkType::worker — സീരിയൽ_ലിങ്ക് ഒബ്‌ജക്റ്റ് ഒരു വർക്കർ ആണ്

isWired

bool

സീരിയൽ_ലിങ്ക് ഒബ്‌ജക്റ്റ് വയർഡ് ആണോ എന്ന് (ഡിഫോൾട്ട് ആയി false):

  • false — സീരിയൽ_ലിങ്ക് ഒബ്‌ജക്റ്റ് വയർഡ് ആണോ
  • true — സീരിയൽ_ലിങ്ക് ഒബ്‌ജക്റ്റ് വയർലെസ് ആണ്

കുറിപ്പുകൾ#

  • VEXlink വയർലെസ്, വയർഡ് ആശയവിനിമയങ്ങളെ പിന്തുണയ്ക്കുന്നു, പവർ റൂട്ടിംഗ് പ്രശ്നങ്ങൾ തടയുന്നതിന് വയർഡ് കണക്ഷനുകൾ പരിഷ്കരിച്ച സ്മാർട്ട് കേബിൾ ശുപാർശ ചെയ്യുന്നു.

  • വയർലെസ് ആശയവിനിമയത്തിന്, ഓരോ റോബോട്ടിനും ഒരു സ്മാർട്ട് പോർട്ടുമായി ബന്ധിപ്പിച്ചിരിക്കുന്ന ഒരു V5 റോബോട്ട് റേഡിയോ ആവശ്യമാണ്.

  • ഒരു EXP കൺട്രോളറിന്റെ VEXnet റേഡിയോയ്‌ക്കൊപ്പം VEXlink റേഡിയോ ഉപയോഗിക്കാം, സംഘർഷങ്ങൾ ഒഴിവാക്കാൻ ഏറ്റവും ഉയർന്ന നമ്പറുള്ള സ്മാർട്ട് പോർട്ടുമായി ഇത് ബന്ധിപ്പിക്കണം.

  • ഒരു VEXlink സൃഷ്ടിക്കാൻ, രണ്ട് EXP ബ്രെയിനുകളും ഒരു V5 റോബോട്ട് റേഡിയോയുമായി ബന്ധിപ്പിച്ചിരിക്കണം.

ഉദാഹരണം#

റോബോട്ട് 1 നുള്ള കോഡ്

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

റോബോട്ട് 2 നുള്ള കോഡ്

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

അംഗ പ്രവർത്തനങ്ങൾ#

serial_link ക്ലാസ്സിൽ ഇനിപ്പറയുന്ന അംഗ ഫംഗ്ഷനുകൾ ഉൾപ്പെടുന്നു:

  • isLinked — EXP ബ്രെയിനുകൾ ജോടിയാക്കുകയും ഈ ലിങ്കിൽ ആശയവിനിമയം നടത്തുകയും ചെയ്യുന്നുണ്ടോ എന്ന് പരിശോധിക്കുന്നു.

  • send — ജോടിയാക്കിയ തലച്ചോറിലേക്ക് ഒരു സന്ദേശം അയയ്ക്കുന്നു.

  • receive — അടുത്ത ഇൻകമിംഗ് സന്ദേശത്തിനായി കാത്തിരുന്ന് തിരികെ നൽകുന്നു.

  • received — ഒരു പുതിയ സന്ദേശം ലഭിക്കുമ്പോഴെല്ലാം വിളിക്കേണ്ട ഒരു ഫംഗ്ഷൻ രജിസ്റ്റർ ചെയ്യുന്നു.

ഏതെങ്കിലും serial_link അംഗ ഫംഗ്ഷനുകൾ വിളിക്കുന്നതിന് മുമ്പ്, താഴെ കാണിച്ചിരിക്കുന്നതുപോലെ ഒരു serial_link ഉദാഹരണം സൃഷ്ടിക്കണം:

റോബോട്ട് 1 നുള്ള കോഡ്

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

റോബോട്ട് 2 നുള്ള കോഡ്

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

isLinked#

ഒരു സീരിയൽ ലിങ്കിലെ EXP ബ്രെയിനുകൾ പരസ്പരം ജോടിയാക്കുന്നുണ്ടോ എന്ന് നൽകുന്നു.

Available Functions
bool isLinked();

Parameters

ഈ ഫംഗ്ഷന് ഒരു പാരാമീറ്ററുകളും ഇല്ല.

Return Values

EXP ബ്രെയിനുകൾ ബന്ധിപ്പിച്ചിട്ടുണ്ടോ എന്ന് സൂചിപ്പിക്കുന്ന ഒരു ബൂളിയൻ നൽകുന്നു:

  • true — The two EXP Brains are paired and communicating on this link.
  • false — The two EXP Brains are not paired on this link.
Notes
  • കൂടുതൽ കോഡുകൾ പ്രവർത്തിപ്പിക്കുന്നതിന് മുമ്പ് ഒരു പ്രോജക്റ്റിന്റെ തുടക്കത്തിൽ EXP ബ്രെയിനുകൾ ബന്ധിപ്പിച്ചിട്ടുണ്ടെന്ന് ഉറപ്പാക്കുന്നത് എപ്പോഴും നല്ല രീതിയാണ്.

Examples

റോബോട്ട് 1 നുള്ള കോഡ്

// Create the link
  serial_link 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");
  Brain.Screen.newLine();
  Brain.Screen.print("Sending message...");

  // Message to send
  const char* message = "Hello Robot 2";

  // Send the message
  link.send((uint8_t*)message, strlen(message));

റോബോട്ട് 2 നുള്ള കോഡ്

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

  // Do not run code UNTIL the Brains are linked
  while (!link.isLinked()) {
    wait(0.1, seconds);
  }
  
  Brain.Screen.print("Robot 2 - Worker");
  Brain.Screen.newLine();
  Brain.Screen.print("Waiting...");

  // Buffer to store incoming bytes
  uint8_t buffer[32] = {0};

  int32_t n = link.receive(buffer, sizeof(buffer) - 1);

  // Null-terminate
  if (n > 0) {
    buffer[n] = 0;

    // Display the message that was sent
    Brain.Screen.clearScreen();
    Brain.Screen.setCursor(1, 1);
    Brain.Screen.print("Robot 2 - Worker");
    Brain.Screen.newLine();
    Brain.Screen.print((char*)buffer);
  }
  else {
    Brain.Screen.newLine();
    Brain.Screen.print("No message received");
  }

send#

ജോടിയാക്കിയ തലച്ചോറിലേക്ക് ഒരു സന്ദേശം അയയ്ക്കുന്നു.

Available Functions

1 — ഒരു ബൈറ്റ് ബഫർ ഉപയോഗിച്ച് ഒരു സന്ദേശം അയയ്ക്കുന്നു.

int32_t send( 
  uint8_t *buffer, 
  int32_t  length );

2 — ഒരു പ്രതീക ബഫർ ഉപയോഗിച്ച് ഒരു സന്ദേശം അയയ്ക്കുന്നു.

int32_t send( 
  const char *buffer, 
  int32_t     length );

Parameters

പാരാമീറ്റർ

ടൈപ്പ് ചെയ്യുക

വിവരണം

buffer

uint8_t* or const char*

ലിങ്ക് ചെയ്‌തിരിക്കുന്ന മറ്റ് EXP ബ്രെയിനിലേക്ക് അയയ്‌ക്കേണ്ട ബഫർ.

length

int32_t

അയയ്ക്കേണ്ട ബഫറിന്റെ നീളം.

Return Values

അയച്ച ബൈറ്റുകളുടെ എണ്ണത്തെ പ്രതിനിധീകരിക്കുന്ന int32_t നൽകുന്നു.

Examples

റോബോട്ട് 1 നുള്ള കോഡ്

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

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

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

  // Track last sent state
  uint8_t lastState = 255;  // impossible initial value

 // Tell Robot 2 when the screen is being pressed
  while (true) {
    uint8_t state = Brain.Screen.pressing() ? 1 : 0;

    // Only send if state changed
    if (state != lastState) {
      link.send(&state, 1);
      lastState = state;
    }

    wait(0.02, seconds);
  }

റോബോട്ട് 2 നുള്ള കോഡ്

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

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

  Brain.Screen.clearScreen();
  Brain.Screen.setCursor(1, 1);
  Brain.Screen.print("Robot 2 - Worker");
  Brain.Screen.newLine();
  Brain.Screen.print("Waiting...");

  // Track the last state
  uint8_t lastShown = 255;

  while (true) {
    // Variable stores 1 - pressed, 0 - not pressed 
    uint8_t state = 0;
    int32_t n = link.receive(&state, 1, 200);

    // Only update screen if state changes
    if (n == 1 && state != lastShown) {
      Brain.Screen.clearScreen();
      Brain.Screen.setCursor(1, 1);
      Brain.Screen.print("Robot 2 - Worker");
      Brain.Screen.newLine();

      // Display text if Robot 1's screen is being pressed
      if (state == 1) {
        Brain.Screen.print("Manager IS being pressed!");
      } else {
        Brain.Screen.print("Manager is NOT being pressed");
      }

      lastShown = state;
    }
    wait(0.02, seconds);
  }

receive#

അടുത്ത ഇൻകമിംഗ് സന്ദേശത്തിനായി കാത്തിരുന്ന് തിരികെ നൽകുന്നു.

Available Functions

1 — ഓപ്ഷണൽ ടൈംഔട്ടുള്ള ഒരു പ്രതീക ബഫറിലേക്ക് ഒരു സന്ദേശം സ്വീകരിക്കുന്നു.

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

Parameters

പാരാമീറ്റർ

ടൈപ്പ് ചെയ്യുക

വിവരണം

buffer

char*

ലഭിച്ച സന്ദേശം സൂക്ഷിക്കുന്നതിനുള്ള ബഫർ.

length

int32_t

ബഫറിന്റെ നീളം.

timeoutMs

int32_t

ക്യൂ ശൂന്യമാണെങ്കിൽ മാത്രം receive ലഭിക്കുന്നതിന് മില്ലിസെക്കൻഡുകളിൽ എത്ര സമയം പുതിയ സന്ദേശത്തിനായി കാത്തിരിക്കും (സ്ഥിരസ്ഥിതിയായി 500ms).

Return Values

ലഭിച്ച ബൈറ്റുകളുടെ എണ്ണത്തെ പ്രതിനിധീകരിക്കുന്ന int32_t നൽകുന്നു.

Notes
  • receive ലഭിക്കുമ്പോൾ, ലിങ്ക് ചെയ്‌തിരിക്കുന്ന മറ്റൊരു EXP ബ്രെയിനിൽ നിന്നുള്ള അടുത്ത ക്യൂ സന്ദേശം തിരികെ ലഭിക്കും.

  • സന്ദേശങ്ങൾ FIFO ക്രമത്തിലാണ് വായിക്കുന്നത് (പഴയതും വായിക്കാത്തതും ആദ്യം).

  • receive വിളിക്കുമ്പോൾ ക്യൂ ശൂന്യമാണെങ്കിൽ, പുതിയ സന്ദേശത്തിനായി നിർദ്ദിഷ്ട timeoutMs വരെ അത് കാത്തിരിക്കും.

  • ആ വിൻഡോയിൽ ഒരു സന്ദേശവും വന്നില്ലെങ്കിൽ, receive 0തിരികെ നൽകുന്നു, തുടർന്ന് അയയ്ക്കുന്ന ഏതൊരു സന്ദേശവും അടുത്ത തവണ receive ഉപയോഗിക്കുമ്പോൾ വായിക്കാനുള്ള ക്യൂവിൽ തുടരും.

Examples

റോബോട്ട് 1 നുള്ള കോഡ്

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

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

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

  // Track last sent state
  uint8_t lastState = 255;  // impossible initial value

 // Tell Robot 2 when the screen is being pressed
  while (true) {
    uint8_t state = Brain.Screen.pressing() ? 1 : 0;

    // Only send if state changed
    if (state != lastState) {
      link.send(&state, 1);
      lastState = state;
    }

    wait(0.02, seconds);
  }

റോബോട്ട് 2 നുള്ള കോഡ്

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

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

  Brain.Screen.clearScreen();
  Brain.Screen.setCursor(1, 1);
  Brain.Screen.print("Robot 2 - Worker");
  Brain.Screen.newLine();
  Brain.Screen.print("Waiting...");

  // Track the last state
  uint8_t lastShown = 255;

  while (true) {
    // Variable stores 1 - pressed, 0 - not pressed 
    uint8_t state = 0;
    int32_t n = link.receive(&state, 1, 200);

    // Only update screen if state changes
    if (n == 1 && state != lastShown) {
      Brain.Screen.clearScreen();
      Brain.Screen.setCursor(1, 1);
      Brain.Screen.print("Robot 2 - Worker");
      Brain.Screen.newLine();

      // Display text if Robot 1's screen is being pressed
      if (state == 1) {
        Brain.Screen.print("Manager IS being pressed!");
      } else {
        Brain.Screen.print("Manager is NOT being pressed");
      }

      lastShown = state;
    }
    wait(0.02, seconds);
  }

received#

EXP ബ്രെയിനിന് അയച്ച സന്ദേശം ലഭിക്കുമ്പോഴെല്ലാം വിളിക്കേണ്ട ഒരു ഫംഗ്ഷൻ രജിസ്റ്റർ ചെയ്യുന്നു.

Available Functions

1 — ലഭിക്കുന്ന ഓരോ സന്ദേശത്തിനും ഒരു കോൾബാക്ക് ഫംഗ്ഷൻ രജിസ്റ്റർ ചെയ്യുന്നു.

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

2 — ഒരു അധിക int32_t ഫീൽഡ് ഉൾപ്പെടുന്ന ഓരോ സന്ദേശത്തിനും ലഭിക്കുന്ന ഒരു കോൾബാക്ക് രജിസ്റ്റർ ചെയ്യുന്നു.

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 — സന്ദേശ പേലോഡിൽ ഒരു അധിക int32_t ഫീൽഡ് ഉൾപ്പെടുന്ന സാഹചര്യത്തിൽ, സന്ദേശവുമായി പൊരുത്തപ്പെടുന്ന പേരുള്ള സ്വീകരിച്ച സന്ദേശങ്ങൾക്ക് മാത്രം അഭ്യർത്ഥിച്ച ഒരു കോൾബാക്ക് രജിസ്റ്റർ ചെയ്യുന്നു.

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

Parameters

പാരാമീറ്റർ

ടൈപ്പ് ചെയ്യുക

വിവരണം

message

const char*

പൊരുത്തപ്പെടേണ്ട സന്ദേശ നാമം (സ്ട്രിംഗ്). ലഭിച്ച സന്ദേശത്തിന്റെ പേര് ഈ മൂല്യവുമായി പൊരുത്തപ്പെടുമ്പോൾ, callback ഫംഗ്ഷൻ വിളിക്കപ്പെടുന്നു.

callback

function

EXP ബ്രെയിനിന് message ന് പൊരുത്തപ്പെടുന്ന ഒരു സന്ദേശം ലഭിക്കുമ്പോൾ പ്രവർത്തിക്കുന്ന ഒരു മുമ്പ് നിർവചിക്കപ്പെട്ട ഫംഗ്ഷൻ.

Return Values

ഈ ഫംഗ്ഷൻ ഒരു മൂല്യം തിരികെ നൽകുന്നില്ല.

Notes
  • received കോൾബാക്കുകൾ വിളിക്കുന്നു:

Callback Signature

callback(message, linkname, index, value)

വാദം

വിവരണം

message

ലഭിച്ച സന്ദേശത്തിന്റെ പേര് (ഉദാഹരണത്തിന്, “add”).

linkname

സന്ദേശം ലഭിച്ച ലിങ്ക് നാമം.

index

സന്ദേശത്തോടൊപ്പം അയച്ച പൂർണ്ണസംഖ്യ മൂല്യം (നൽകിയിട്ടുണ്ടെങ്കിൽ).

value

സന്ദേശത്തോടൊപ്പം അയച്ച ഫ്ലോട്ട് മൂല്യം (നൽകിയിട്ടുണ്ടെങ്കിൽ).

Examples

റോബോട്ട് 1 നുള്ള കോഡ്

// Send left or right when pressed
void screen_pressed() {
  if (Brain.Screen.xPosition() < 240) {
    link.send((uint8_t*)"left", 4);
  } else {
    link.send((uint8_t*)"right", 5);
  }
}

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

// Create the link
serial_link 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");


  Brain.Screen.pressed(screen_pressed);
}

റോബോട്ട് 2 നുള്ള കോഡ്

// Called when message received
void received_callback(uint8_t *buffer, int32_t length) {
  char msg[32];

  // Copy safely and null terminate
  int n = (length < 31) ? length : 31;
  memcpy(msg, buffer, n);
  msg[n] = '\0';

  Brain.Screen.clearScreen();
  Brain.Screen.setCursor(1,1);
  Brain.Screen.print("Robot 2 - Worker");
  Brain.Screen.newLine();

  // Display if Robot 1's screen is pressed on left or right
  if (strcmp(msg, "left") == 0) {
    Brain.Screen.print("Manager pressed LEFT");
  }
  else if (strcmp(msg, "right") == 0) {
    Brain.Screen.print("Manager pressed RIGHT");
  }
}

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

// Create the link
serial_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(received_callback);

  Brain.Screen.clearScreen();
  Brain.Screen.setCursor(1,1);
  Brain.Screen.print("Robot 2 - Worker");
  Brain.Screen.newLine();
  Brain.Screen.print("Waiting...");
}

previous

സന്ദേശ ലിങ്ക്

next

സിടിഇ വർക്ക്സെൽ

On this page
  • ആമുഖം
  • ക്ലാസ് കൺസ്ട്രക്‌ടറുകൾ
  • ക്ലാസ് ഡിസ്ട്രക്റ്റർ
  • പാരാമീറ്ററുകൾ
  • കുറിപ്പുകൾ
  • ഉദാഹരണം
  • അംഗ പ്രവർത്തനങ്ങൾ
    • isLinked
    • send
    • receive
    • received
Innovation First, International
​

VEX ഉം VEX റോബോട്ടിക്സും ഇന്നൊവേഷൻ ഫസ്റ്റ്, ഇൻ‌കോർപ്പറേറ്റഡിന്റെ വ്യാപാരമുദ്രകളോ സേവന മാർക്കുകളോ ആണ്. പകർപ്പവകാശം ©2026എല്ലാ അവകാശങ്ങളും നിക്ഷിപ്തം. VEX റോബോട്ടിക്സ്, ഇൻ‌കോർപ്പറേറ്റഡ് ഇന്നൊവേഷൻ ഫസ്റ്റ് ഇന്റർനാഷണൽ, ഇൻ‌കോർപ്പറേറ്റഡിന്റെ ഒരു അനുബന്ധ സ്ഥാപനമാണ്. മറ്റുള്ളവരുടെ മറ്റെല്ലാ ഉൽപ്പന്ന നാമങ്ങളും / മാർക്കുകളും അവയുടെ ഉടമസ്ഥരുടെ സ്വത്താണ്. പേറ്റന്റുകളും / അല്ലെങ്കിൽ പേറ്റന്റുകളും തീർപ്പുകൽപ്പിച്ചിട്ടില്ല - innovationfirst.com/patents
സൈറ്റ് സ്വകാര്യതാ നയം / സൈറ്റ് ഉപയോഗ നിബന്ധനകൾ / കുക്കി നയം / സോഫ്റ്റ്‌വെയർ സ്വകാര്യതാ നയം

VEX റോബോട്ടിക്സ് ഫേസ്ബുക്ക് പേജ് സന്ദർശിക്കുക VEX റോബോട്ടിക്സ് ട്വിറ്റർ പേജ് സന്ദർശിക്കുക VEX റോബോട്ടിക്സ് ഇൻസ്റ്റാഗ്രാം പേജ് സന്ദർശിക്കുക VEX റോബോട്ടിക്സ് യൂട്യൂബ് പേജ് സന്ദർശിക്കുക
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)