Bluetooth client speed and buffering issue

Kind of. I have nothing to test the code with right now, so no doubt you will need to fix my bugs! Note, if the connection works and data streams but starts to fail, tweak the milliseconds up in both the Script and the App. A faster phone could make a difference.

Script snippet:

ScriptSnippet.txt (732 Bytes)

byte a[4];
int i = 0;

void loop() {

         if (millis() - oldmillis >= 10)
         {
               oldmillis = millis();

                    a[i] = map(analogRead(A0), 0, 4096.0, 0, 255);

                       i = i + 1;

               If(i > 3)
               {
                         i = 0;

                         ESP_BT.write(a[0]);
                         ESP_BT.write(',');
                         ESP_BT.write(a[1]);
                         ESP_BT.write(',');
                         ESP_BT.write(a[2]);
                         ESP_BT.write(',');
                         ESP_BT.write(a[3]);
                         ESP_BT.write('\n');
               }
         }
}

App Code:
I have butchered my BT Basic Template that has been successfully used by many people, but that does not mean the butchered version will work as expected :upside_down_face

Note, Test as an APK, not via the Companion.

Tips:

  1. Do not run from the finished install panel displayed, run via the App Icon.
  2. If an eligible device is within 2-3 metres of your phone/tablet, it probably won't be found (Bluetooth flaw).

BT_4ValsStreamIn.aia (12.8 KB)

(Click on the image to view at full scale)

Edit: Script snippet BT packet array corrected.
Edit2: Script snippet file updated