# Android Bluetooth

**URL:** <https://discourse.processing.org/t/android-bluetooth/27140>\
**Category:** Gallery\
**Created:** [January 17, 2021, 11:33am UTC](https://discourse.processing.org/t/android-bluetooth/27140 "2021-01-17T11:33:17Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [January 20, 2021, 6:26am UTC](https://discourse.processing.org/t/android-bluetooth/27140/13 "2021-01-20T06:26:49Z")

</div>

Let’s say your Arduino has 4 sensors.  
In the main loop of the arduino sketch, you will add a ‘!’ delimitor only at the first sensor data, because this is the main delimiter. On the subsequent ones you use the ‘#’ delimiter, like:

```auto
while (mySerial.available() <= 0) { 
    y_1 = int(data_sensor_1);
    mySerial.print(String(y_1) + '!');

    y_2 = int(data_sensor_2);
    mySerial.print(String(y_2) + '#');

    y_3 = int(data_sensor_3);
    mySerial.print(String(y_3) + '#');

    y_4 = int(data_sensor_4);
    mySerial.print(String(y_4) + '#' );
  }

```

In the processing sketch, in the plot() function, you will receive a string to be split only on the ‘#’ delimiter, because the main delimiter ‘!’ was already captured, spit and removed in the connect() function.  
The channel data can now be split in the plot() function as follows.

```auto
void plot(String r_str) {
  if (r_str.length() < 7 || r_str == null) r_str = "0#0#0#0";
  if (plotting) {
    y_values = split(r_str, "#");
    y_1 = int(y_values[0])
    y_2 = int(y_values[1])
    y_3 = int(y_values[2])
    y_4 = int(y_values[3])
  }
}

```

Please if you have further questions post them [here](https://discourse.processing.org/t/android-bluetooth-to-arduino-and-vice-versa/26578/141), to not extend this topic too much.

---

_[View the full topic](https://discourse.processing.org/t/android-bluetooth/27140)._
