This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to send simple string data ?

I am receiving data from a phone, i want to send back a word .

So , this is probably wrong but , to send :

  void sendBluetoothData( uint8_t data[], uint16_t length)
  {
      uint32_t       err_code;
      static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
      err_code = ble_nus_string_send(&m_nus, data, length);
       if ( (err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_BUSY) )
        {
             //APP_ERROR_CHECK(err_code);
        }
  }

and use it with :

  uint8_t tosend[5];
     tosend[0]=7;
     tosend[1]=2;
     tosend[2]=7;
     tosend[3]=6;
     sendBluetoothData(tosend,4);

I think it sends 0 twice back to the phone.

How should I re-write this function to send strings out ?

(using SDK 13 with the uart example which I try to write by my self)

Parents Reply Children
No Data
Related