0 Replies Latest reply on Nov 20, 2020 7:16 PM by JoBa_4600301

    What is an efficient way to stream data from 6 ADC over BLE?

    JoBa_4600301

      Hi,

      I'm looking to stream the data read from 6ADC over BLE.  I'm currently basing my code on the battery_level example but the communication is very slow -I'm getting 2 readings (2bytesx6) per second at the server side (windows computer running python script).   I think I'm not using the right command to send the data.  The way I'm doing it now is by using 6 services (see complete code attached) like this:

       

      Thanks in advance for the help.

       

           ADC_StartConvert();

          ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);

       

       

              adcResult = ADC_GetResult16(0u);

              adcResult1 = ADC_GetResult16(1u);

              adcResult2 = ADC_GetResult16(2u);

              adcResult3 = ADC_GetResult16(3u);

              adcResult4 = ADC_GetResult16(4u);

              adcResult5 = ADC_GetResult16(5u);

             

       

            mvolts0 = ADC_CountsTo_mVolts(0,adcResult);

          mvolts1 = ADC_CountsTo_mVolts(1,adcResult1);

          mvolts2 = ADC_CountsTo_mVolts(2,adcResult2);

          mvolts3 = ADC_CountsTo_mVolts(3,adcResult3);

          mvolts4 = ADC_CountsTo_mVolts(4,adcResult4);

          mvolts5 = ADC_CountsTo_mVolts(5,adcResult5);

       

              CYBLE_GATTS_HANDLE_VALUE_NTF_T tempHandle;

              tempHandle.attrHandle=CYBLE_PDIODE_DDIODE_CHAR_HANDLE;

              tempHandle.value.val = &mvolts0;  //(uint8 *)&mvolts1_int;

              tempHandle.value.len=sizeof(mvolts0);

              CyBle_GattsNotification(cyBle_connHandle,&tempHandle);

             

                     tempHandle.attrHandle=CYBLE_PDIODE_2_DDIODE_CHAR_HANDLE;

              tempHandle.value.val = &mvolts1;

              tempHandle.value.len=sizeof(mvolts1);

              CyBle_GattsNotification(cyBle_connHandle,&tempHandle);

             

                      tempHandle.attrHandle=CYBLE_PDIODE_3_DDIODE_CHAR_HANDLE;

              tempHandle.value.val = &mvolts2;

              tempHandle.value.len=sizeof(mvolts2);

              CyBle_GattsNotification(cyBle_connHandle,&tempHandle);

             

                             tempHandle.attrHandle=CYBLE_PDIODE_4_DDIODE_CHAR_HANDLE;

              tempHandle.value.val = &mvolts3;

              tempHandle.value.len=sizeof(mvolts3);

              CyBle_GattsNotification(cyBle_connHandle,&tempHandle);

             

                             tempHandle.attrHandle=CYBLE_PDIODE_5_DDIODE_CHAR_HANDLE;

              tempHandle.value.val = &mvolts4;

              tempHandle.value.len=sizeof(mvolts4);

              CyBle_GattsNotification(cyBle_connHandle,&tempHandle);

             

                             tempHandle.attrHandle=CYBLE_PDIODE_6_DDIODE_CHAR_HANDLE;

              tempHandle.value.val = &mvolts5;

              tempHandle.value.len=sizeof(mvolts5);

              CyBle_GattsNotification(cyBle_connHandle,&tempHandle);

             

               apiResult = CyBle_BassSendNotification(cyBle_connHandle, 0u,

                      0u, sizeof(batteryLevel), &batteryLevel);