title: Arduino --> Android bluetooth communication (receive text with App Inventor)
body: <p>I'm creating an Arduino based drone that can be controlled through an Android application.
  In order to improve the user experience, I'd like to show the accelerometer/compass sensor's values on the application, so I need to send them from Arduino to Android, via Bluetooth. The values are simple integer number between 0 and 180.</p>
  
  <p>The best solution I thought is to concatenate all the values (separated with a comma) in one string, and send it to the app, that will separate the single values (the string will be sent only when the app require it, in this case when a 'z' byte is received by Arduino).</p>
  
  <pre><code>if (Serial.available() &gt; 0) {
      if (Serial.read()=='z'){
          Serial.println(String((int)sensor1) + ',' + String((int)sensor2) + ',' + String((int)sensor3));
      }  
   }
  </code></pre>
  
  <p>Here are the App Inventor blocks:
  <img src="https://i.stack.imgur.com/8nkE9.png" alt="App Inventor pseudo-code"></p>
  
  <p>It seems that the values are being received quite well, but there is a critical issue: somethimes the string is not received well, and that cause a lot of errors. Sometimes the received string is (for example) 10,10,10, but somethimes it is 10,10,1010 or just 10,10 ecc...</p>
  
  <p>I also tried to send the values one by one, but the result was nearly the same.
  I even tried to set 'numberOfBytes' to -1, using a delimiter byte, but this also was not succesful unfortunately.</p>
  
  <p>I getting quite mad, so I hope there is another way to send thoose integers to Android, or to fix the system I'm already using.</p>