I'm using 14.2 SDK SES . I'm trying to send data of sensor through BLE . When i enable Notification in mobile applicaion (nRF connect) i generally dont get any value or garbage values. I combined saadc and ble_app_uart application for this .
Here is the code for sending data :
void saadc_callback(nrf_drv_saadc_evt_t const * p_event) { if (p_event->type == NRF_DRV_SAADC_EVT_DONE) { ret_code_t err_code; uint8_t value[BLE_NUS_MAX_DATA_LEN]; static uint8_t index = 0; err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER); APP_ERROR_CHECK(err_code); // printf("x = %d\r\n", p_event->data.done.p_buffer[0]); // the above line prints correctly the sensor data . But when i try to save it , garbage value are stored . sprintf(value[0] , "testing = %d",p_event->data.done.p_buffer[0]); printf(value); uint16_t length = (uint16_t)index; ble_nus_string_send(&m_nus, value , &length); m_adc_evt_counter++; } }
// printf("x = %d\r\n", p_event->data.done.p_buffer[0]);
This line correctly prints sensor data but when i store , garbage value are stored . I also used sprintf function . Still getting garbage values .