how to use metawear-sdk-cpp in C on Ubuntu.


  Greeting,

   wrote a c program to interface with the api without luck.
   Anyone could kindly share a sample C/C++ code? Thanks in advance.

  

Comments

    • What code have you written thus far?
    • How have you compiled the code?
    • What errors are you seeing?

  •      tried to write C code to call metawear API to get battery status, started with the following  
         simple code to test out the C code. 
       #include "metawear/core/connection.h"
        #include "metawear/core/metawearboard.h"
       
        int main(int argc, char **argv) {
            MblMwBtleConnection btle_conn = { write_gatt_char, read_gatt_char, enable_char_notify };
            MblMwMetaWearBoard* board = mbl_mw_metawearboard_create(&btle_conn);

           
            
        }

       I was using g++ to compile the code and specifies the header locations, but the compiling errors
       complaining cannot find the header files, such as module.h, model.h, metawearboard_fwd.h. 
       noticed that there was no connection.h in core directory. 
         
  • "metawear/core/connection.h" was moved to "metawear/platform/btle_connection.h" in a later release, looks like the documentation wasn't updated to reflect the change.  That issue aside, it also looks like your g++ flags are not correct.  Please post your g++ command as well as the compile errors.
  • Hey, I am facing the same problem.
    The command is used was just "make sampleFile" which is g++ sampleFile.cpp -o sampleFile.
    What is the correct way?

  • @mogambo said:
    Hey, I am facing the same problem.
    The command is used was just "make sampleFile" which is g++ sampleFile.cpp -o sampleFile.
    What is the correct way?

    Add the usual g++ include and library flags

This discussion has been closed.