IONIC bluetooth communication

Hello, I’m new using Ionic framework.

I’m trying to communicate one bluetooth connect to an Arduino with my app.
I have a button on my app that when pressed allowed the Arduino to start sending serial data.

ARDUINO

void loop()  
{
  if (bluetooth.available()>0) { 
    
    b1 = bluetooth.read(); 
    command += b1; 
    Serial.print(command);
    delay(100); 
    if (b1 == 'a'){ //Verifying if its allowed to send data
      dados = bluetooth.write("180,190,30,50,20,15,35"); //Data
      Serial.print(dados);
  }

But when the app receive this data I have two problems

First:
I’m trying to reach all char array and separate my numbers, but every time I do that I received nothing in my toast message.

Second:
If I remove the while, the first time I read a message I received in my toast message and undefined.

IONIC

comBluetooth() {

    var char: any;
    var i: number = 0;
    var o: number = 0;
    var parada: any = ",";
    var dados: number[];
    var convert: any = "";
    var tamanho: number;

    this.bluetoothSerial.write('a');

    this.bluetoothSerial.readUntil('n')
    .then((dadoRecebido: any) => {
      char = String(dadoRecebido);
      
      tamanho = char.length;
      
      while(i < tamanho){
        if(char[i].localCompare(",") == 0){
          dados[o] = parseFloat(convert);
          o = o + 1;
        }else{
          convert = convert + char[i];
          i = i + 1;      
        }
      }
      this.toast.create({ message: char, duration: 3000, position: 'botton' }).present();
      this.bluetoothSerial.clear();
    });
 }

Could anyone help me with the correctly way to do this communication? As I said I’m new in ionic framework so any detailed information will helps a lot.

Thanks

I solved the second problem.

I think that putting write command allowing arduino to start sending data and just after read theses information was to fast to received all data.