Vex Link Help

Hey everyone, I am trying to configure vex link to work on my two AI robots. i used this code to configure them and they link and blink accordingly

vex::message_link LinkA( PORT20, "vex_robotics_team_2147_Z", linkType::manager );

However, the code wont build when i try to use some of the code from the API

    LinkA.received("run", isoAutonDev);


indows build for platform vexv5
clean project

windows build for platform vexv5
"CXX src/main.cpp"
src/main.cpp:161:11: error: no matching member function for call to 'received'
    LinkA.received("run", isoAutonDev);
    ~~~~~~^~~~~~~~
c:\Users\Murad\AppData\Roaming\Code\User\globalStorage\vexrobotics.vexcode\sdk\cpp\V5\V5_20240223_11_00_00/vexv5/include/vex_vexlink.h:131:19: note: candidate function not viable: no known conversion from 'void ()' to 'void (*)(const char *, const char *, double)' for 2nd argument
      void        received( const char *message, void (* callback)(const char *, const char *, double) );
                  ^
c:\Users\Murad\AppData\Roaming\Code\User\globalStorage\vexrobotics.vexcode\sdk\cpp\V5\V5_20240223_11_00_00/vexv5/include/vex_vexlink.h:132:19: note: candidate function not viable: no known conversion from 'void ()' to 'void (*)(const char *, const char *, int32_t, double)' (aka 'void (*)(const char *, const char *, long, double)') for 2nd argument
      void        received( const char *message, void (* callback)(const char *, const char *, int32_t, double) );
                  ^
c:\Users\Murad\AppData\Roaming\Code\User\globalStorage\vexrobotics.vexcode\sdk\cpp\V5\V5_20240223_11_00_00/vexv5/include/vex_vexlink.h:128:19: note: candidate function not viable: requires single argument 'callback', but 2 arguments were provided
      void        received( void (* callback)(const char *, const char *, double) );
                  ^
c:\Users\Murad\AppData\Roaming\Code\User\globalStorage\vexrobotics.vexcode\sdk\cpp\V5\V5_20240223_11_00_00/vexv5/include/vex_vexlink.h:129:19: note: candidate function not viable: requires single argument 'callback', but 2 arguments were provided
      void        received( void (* callback)(const char *, const char *, int32_t, double) );
                  ^
c:\Users\Murad\AppData\Roaming\Code\User\globalStorage\vexrobotics.vexcode\sdk\cpp\V5\V5_20240223_11_00_00/vexv5/include/vex_vexlink.h:144:19: note: candidate function not viable: requires single argument 'callback', but 2 arguments were provided
      void        received( void (* callback)(const char *, data& data) );
                  ^
1 error generated.

make: *** [vex/mk

please advise!

Would need to see the callback isoAutonDev.

it either needs to of the form

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

or

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

for example, from the documentation

void
start_motor( const char *message, const char *linkname, int32_t index, double value ) {
// message is the received message
// linkname is the link name for the message_link that received the message
// index is optional int32_t variable
// value is optional double variable
}

I assume you have read this.

2 Likes

Thank you so much! Also, could a worker send a message back to the manager using message_link or would i have to have a separate radio and link for that lane of communication?

Either end of the link can send a message.

3 Likes