0

I am being sent capacitance readings and temperature sensor readings over bluetooth using UART.

I am attempting to do this by editing a pre existing open source app called nRF-UART.

I am trying to display the temperature data on a live updating static text view, and display the capacitance data as a vertical progress bar to show the level of water being measured. In order to do that I think I need the capacitance data to be on a separate string from the temperature data.

Here is where the string is being printed out at:

   if (action.equals(UartService.ACTION_DATA_AVAILABLE)) {

                 final byte[] txValue = intent.getByteArrayExtra(UartService.EXTRA_DATA);
                 runOnUiThread(new Runnable() {
                     public void run() {
                         try {
                            String text = new String(txValue, "UTF-8");
                                listAdapter.add(text);
                                messageListView.smoothScrollToPosition(listAdapter.getCount()-1);


                         } catch (Exception e) {
                             Log.e(TAG, e.toString());
                         }
                     }
                 });
             } 

How can I split up the values and bring them outside of `listAdapter'?

The string will look like this

1,75,460,0 

Where 75 is the temperature in Fahrenheit, and 460 is the capacitance reading in mL. 1 is just a starting bit, and 0 is the ending bit.

Mark Lupas
  • 21
  • 3

0 Answers0