6 Replies Latest reply on Jul 30, 2016 2:38 PM by FerryT

    MRAA UART - Read & Write Data C

    seamus1982

      Hi,

       

      I am new to programming embedded technology. I want to communicate with a device through serial port. I am going to use the MRAA library. However, I don't know how to write and receive data with it. I initalise the serial port with the following code.

       

      #include "mraa.h"

      int

      main(int argc, char** argv)

      {

          mraa_uart_context uart;

          uart = mraa_uart_init(0);

          if (uart == NULL) {

              fprintf(stdout, "UART failed to setup\n");

          }

          mraa_deinit();

          return 0;

      }

       

      But I don't know how to send a string and wait for a response. Any help would really be appreciated. Learning this stuff, is like learning how to program again.

       

      Best regards,

            Seamus