Hi there! I'm using the nRF Toolbox's UART to test the receiving of my data stream. I'm trying to send a data array collected (from spi) in my main loop and send it via UART-BLE to my mobile phone. However, on the Toolbox app, I'm not receiving any string from my peripheral even though I called ble_nus_string_send.
//Global variable
bool ble_connected = false;
----------
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
ble_connected = true;
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
break;
case BLE_GAP_EVT_DISCONNECTED:
ble_connected = false;
m_conn_handle = BLE_CONN_HANDLE_INVALID;
break;
}
}
----------
int main (void)
{
/* SPI data comes in and gets stored into array data_array */
data_array[0] = something;
data_array[1] = something;
data_array[2] = something;
if(ble_connected)
ble_nus_string_send(&m_nus, data_array, length_of_data_array)
}