Bluetooth client speed and buffering issue

Hi javier

There are very few times when a delay can be used safely - the reason being that it blocks everything. Here is an example Sketch showing how to use elapsed milliseconds:

//#include<SoftwareSerial.h>

//vars
unsigned int igUpdateTime;
char val[];

void setup()
{
         Serial.begin(9600);
         igUpdateTime = millis();
}

void loop()
{
         //Excute loop every 10 seconds
	     if((millis() - igUpdateTime) > 10000) 
         {
              igUpdateTime = millis();

              if (Serial.available() > 0)
              {
                   //Read Data From App
                   val = Serial.read();

                   switch (val) {

                     case '1':
                              digitalWrite(led1, HIGH);
                              break;

                     case '2':
                              digitalWrite(led1, LOW);
                              break;

                     case '3':
                              digitalWrite(led2, HIGH);
                              break;

                     case '4':
                              digitalWrite(led2, LOW);
                              break;
                   }
              }
         }
}

Thanks to everybody!
I use often millis() to avoid block my Arduino. My main question is about the official documents for technical information about buffers because I need to avoid the overflow. Where can I find information about them ?

When the App has read the data, the buffer is empty until the Arduino sends again. So to avoid overflow, follow my advice in my post above.