Problem with IF

Hello Arduino-mates,

I have a problem and I don't know solve. I have a code that send a receive messages through of SOCKET. Well, the problem is that I send messages that start with "#" and finish with "@", for example "#19CP@".
When I send this instruction with a program of VisualBasic, Arduino answers me ERROR MENSAJE. This is the message that I have to receive if the instruction isn't known. Then if you read the code, you can see that the Arduino doesn't enter in IF. When this happen the Arduino stops and I have to do a RESET but I don't undestand what is the reason.
So I have a question, why doesn't Arduino enter to the correct IF? You can see that the message is correct #19CP@. I don't understand anything. Can you help me?? Thank you.
The code is in the next post because here it didn't enter.

/***************************** FUNCION ENVIA MENSAJES */ 
int FEnviaMensaje()
{
  Serial.println("Enviando Message");
  int i=0;
  for (i = 0; i < gsMenEnviar.length() ; i++)
        server.write(gsMenEnviar[i]);
  Serial.println(gsMenEnviar);
  return 0;  
}
/***************************FUNCION TRATA MENSAJES */ 
int TrataMensajeRecibidoTCP()
{
   Serial.println("entro a funcion de trata de mensajes");
   int liRet = 0;
   int i=0;
   int liValor = 0;
   String lsAux = "";
   int liAddress = 0;
    gsMenEnviar = "#ERROR MENSAJE@";
   Serial.println("FEnviaMensaje");    
   if (gsMenRecibido[0] == '1' && gsMenRecibido[1] == '9')
   {
       if (gsMenRecibido[2] == 'S')
       {
            if (gsMenRecibido[3] == 'F')
            {
                  if (gsMenRecibido[4] == 'R')
                                 gsMenEnviar = "#RESETDEMANDAFIJAOK@"; 
                  else // Establece demandas fijas
                  {        
                      lsAux = String(gsMenRecibido[4]) + String(gsMenRecibido[5]) + String(gsMenRecibido[6]) + String(gsMenRecibido[7]);
                      giG1Dfijo = lsAux.toInt();
                      lsAux = String(gsMenRecibido[8]) + String(gsMenRecibido[9]) + String(gsMenRecibido[10]) + String(gsMenRecibido[11]);
                      giG2Dfijo = lsAux.toInt();
                      giIndDemandaFija = 1 ;
                      gsMenEnviar = "#DEMANDASFIJASOK@";
                    }    
            }
     }
     if (gsMenRecibido[2] == 'T')
     {
            if (gsMenRecibido[3] == 'S')
            {
                  lsAux = String(gsMenRecibido[4]) + String(gsMenRecibido[5]); 
                 day = lsAux.toInt();
                 lsAux = String(gsMenRecibido[7]) + String(gsMenRecibido[8]);
                 month = lsAux.toInt();
                 lsAux = String(gsMenRecibido[10]) + String(gsMenRecibido[11]) + String(gsMenRecibido[12]) + String(gsMenRecibido[13]);
                 year = lsAux.toInt();
                 lsAux = String(gsMenRecibido[15]) + String(gsMenRecibido[16]);
                 hour = lsAux.toInt();
                 lsAux = String(gsMenRecibido[18]) + String(gsMenRecibido[19]);
                 min = lsAux.toInt();
                 lsAux = String(gsMenRecibido[21]) + String(gsMenRecibido[22]);
                 second = lsAux.toInt();
                 RTC.adjust(DateTime(year, month, day, hour, min, second));
          }
       Serial.println("-" + gsMenEnviar + "-");
      gsMenEnviar = String("#T" + String(now.month()) + "-" + String((int)now.day()) + " H:" + String((int)now.hour()) + ":" + String((int)now.minute()) + ":" + String((int)now.second())+ "@");
      Serial.print("-" + gsMenEnviar + "-");
      Serial.println();
    }    
    if (gsMenRecibido[2] == 'D') 
    {
        if (gsMenRecibido[3] == 'D')
            gsMenEnviar = "#DD" + String(giG1D) + "," + String(giG2D)+ "@";
        else
        {     
             gsMenEnviar = "#DR";
             for(i=0 ; i < 5; i++)
                  gsMenEnviar += String(giValActualG1[i]) + "," + String(giValActualG2[i]) + ",";
             gsMenEnviar += "@";
        }
    } 
   if (gsMenRecibido[2] == 'C')
   {
         if (gsMenRecibido[3] == 'P')
         {
             giIndCalibrando = 1;
             if (giIndCalibrando == 1)
             {
                 for (p=0; p<5; p++)
                 {
                     digitalWrite(giPinSeguidorG1[p], LOW);
                     digitalWrite(giPinSeguidorG2[p], LOW);
                 }
                 digitalWrite(PinAccionG1, LOW);
                 digitalWrite(PinSentidoG1, LOW);
                 digitalWrite(PinSentidoG2, LOW);
            }     
           gsMenEnviar = "#CALIBRANDO@"; 
         }
         else if (gsMenRecibido[3] == 'A')
         {
                gsMenEnviar = "#CA";
                for (i=0; i < 5; i++)
                {
                    giValActualG100[i] = TransAnGra(giEAnalogicasG1[i], 1, 0, i, 1);
                    giValActualG200[i] = TransAnGra(giEAnalogicasG2[i], 1, 0, i, 2);
                    gsMenEnviar += String(giValActualG100[i]) + "," + String(giValActualG200[i]) + ",";
                }
                gsMenEnviar += "@";
         }
         else if (gsMenRecibido[3] == 'B')
         {        
                lsAux = String(gsMenRecibido[4]) + String(gsMenRecibido[5]);  
                liValor = lsAux.toInt();
                Serial.println(String(liValor));
                gsMenEnviar = "#CB";
                for (i=0; i < 5; i++)
                {
                    giValActualG1XX[i] = TransAnGra(giEAnalogicasG1[i], 1, 0, i, 1);
                    gdPendienteG1[i] = (double)liValor / (double)(giValActualG1XX[i] - giValActualG100[i]) ;
                    giOffSetG1[i] = - (gdPendienteG1[i] * giValActualG100[i]);
                    gsMenEnviar += String(giValActualG1XX[i]) + "," + String((int)gdPendienteG1[i]) + "," + String(giOffSetG1[i]) + ",";
                }
                gsMenEnviar += "@";
         }
         else if (gsMenRecibido[3] == 'C')
         {        
                lsAux = String(gsMenRecibido[4]) + String(gsMenRecibido[5]);                
                liValor = lsAux.toInt();
                gsMenEnviar = "#CC";
                for (i=0; i < 5; i++)
                {
                    giValActualG2XX[i] = TransAnGra(giEAnalogicasG2[i], 1, 0, i, 2);
                    gdPendienteG2[i] = (double)liValor / (double)(giValActualG2XX[i] - giValActualG200[i]) ;
                    giOffSetG2[i] = - (gdPendienteG2[i] * giValActualG200[i]);
                    gsMenEnviar += String(giValActualG2XX[i]) + "," + String((int)gdPendienteG2[i]) + "," + String(giOffSetG2[i]) + ",";
                }
                gsMenEnviar += "@";
         }
         else if (gsMenRecibido[3] == 'I')
         {
                  gsMenEnviar = "#CI";
                  for (i=0; i < 5; i++)
                  {
                        giValActualG1[i] = TransAnGra(giEAnalogicasG1[i], gdPendienteG1[i], giOffSetG1[i], i, 1);
                        gsMenEnviar += String(giValActualG1[i]) + "=(";
                        liValor = TransAnGra(giEAnalogicasG1[i], 1, 0, i, 1);
                        gsMenEnviar += String(liValor) + "*" + String((int)gdPendienteG1[i]) + ")+" + String(giOffSetG1[i]) + ";";
                        giValActualG2[i] = TransAnGra(giEAnalogicasG2[i], gdPendienteG2[i], giOffSetG2[i], i, 2);
                        gsMenEnviar += String(giValActualG2[i]) + "=(";
                        liValor = TransAnGra(giEAnalogicasG2[i], 1, 0, i, 2);
                        gsMenEnviar += String(liValor) + "*" + String((int)gdPendienteG2[i]) + ")+" + String(giOffSetG2[i]) + ";";
                  }
                  gsMenEnviar += "@";
         }      
         else if (gsMenRecibido[3] == 'S')
         {
             EEPROM.writeInt(giAddress, 1);
             giIndCalibrado = 1;
             for (i=0; i<5 ; i++)
             {
                  EEPROM.writeFloat(giAddress+1+(i*12), gdPendienteG1[i]);
                  EEPROM.writeFloat(giAddress+5+(i*12), gdPendienteG2[i]);
                  EEPROM.writeInt(giAddress+9+(i*12), giOffSetG1[i]);
                  EEPROM.writeInt(giAddress+11+(i*12), giOffSetG2[i]);
              }         
              gsMenEnviar = "#EEPROMOK@"; 
              giIndCalibrando = 0;
         }      
     }       
  }
  else
  {
     liRet = -1;
  }
  FEnviaMensaje();
  return liRet;  
}
/************************ FUNCION ATIENDE PETICIONES*/ 
int FAtiendePeticionesTCP()
{
  int liRet = 0;
  char c ;  
  gsMenRecibido="";
  EthernetClient client = server.available(); 
  if (client)
  {
    if (client.connected()) 
    {
          Serial.println("cliente conectado");
          while ((client.available()) ) 
          {      
              c = client.read();        
              if (c == '#') 
              {
                gsMenRecibido = "";
                Serial.println("mensaje: #");          
              }
              else if ( c == '@')
              {
                liRet = TrataMensajeRecibidoTCP();
                Serial.println("mensaje: " + gsMenRecibido);          
                client.flush();
                client.stop();
              }
              else 
              {
                gsMenRecibido+=c;//store the recieved chracters in a string      
              }
          }
    } 
  }
  return liRet;
}

You are pissing away resources right and left with the String misuse.

  for (i = 0; i < gsMenEnviar.length() ; i++)
        server.write(gsMenEnviar[i]);

If gsMenEnviar is a String, why do you think you need to generate one 500+ byte packet per character? Send the whole damned String at once. Or, better yet, ditch the String, and send the whole string at once.

    [color=red] gsMenEnviar = "#ERROR MENSAJE@";[/color]

Does this really compile?

This is the message that I have to receive if the instruction isn't known. Then if you read the code, you can see that the Arduino doesn't enter in IF.

No, I can't see that, as you haven't posted complete code, and have not said what you think gsMenRecibido contains OR shown any proof that it actually contains that OR defined which of your 40 bazillion if statements you are talking about (since there are not IF statements).

By the way, an if isn't entered. The statement in the parentheses either evaluates to true, and the body is executed, or to false, and the body is not executed.

See the fine folks at http://snippets-r-us.com for help with your snippets.

Hi,

In the first place, ... It is so in my post because I thought that I could mark the parts that I say, but now I know that it isn't possible in code.
Well, about your answer, "gsMenEnviar" contain a string for example "19CP".
I don't understand that you want say me with "500+ byte". I send the message byte to byte, what is the problem? Can you tell me if it exists other solution to do this communication because can be that I am doing wrong something?

Thank you for your answer.

I don't understand that you want say me with "500+ byte". I send the message byte to byte, what is the problem?

Yes, you send the message byte by byte, here:

  for (i = 0; i < gsMenEnviar.length() ; i++)
        server.write(gsMenEnviar[i]);

Each call to server.write() creates a packet, and dispatches it to the network. The packet is 500+ bytes, and contains one byte that your server needs. You do this 15 times, since there are 15 characters in the String.

server.print(gsMenEnviar);

Will send ONE packet, because there is just one call. That packet will contain 15 bytes of interest to your server.

Hi again,

Thanks for your answer. I have done that change of instruction and now is correct. The problem that I asked is right. But now appear other problem. I give you the code. You can see in the "void loop" that I've write a IF. If I delete this if the solution is correct and all is OK, but if I leave this if the programming stop its execution. Would you know you tell me what could be the problem now? I don't understand why the process stops.
The code is in the next message:

#include <SPI.h>
#include <Ethernet.h>
#include <Wire.h>   // Incluye la libreria Wire
#include <EEPROMEx.h>
#include <math.h>
int giG1D;
int giG2D;
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xB7, 0xC7 };
IPAddress ip(192,168,0, 5);
int serverPort=60;
RTC_DS1307 RTC;
DateTime now;
int year =2013;
int month =0;
int day =0;
int hour =0;
int min =0;
int second =0;
const int giPinA[5] = {36, 32, 31, 30, 33}; 
int PinSA1 = 48;
int PinAA1 = 45; 
const int giPinB[5] = {38, 37, 39, 42, 41}; 
int PinSB2 = 47;
const int giEAnalogicasG1[5]= {0, 1, 2, 3, 4}; 
const int giEAnalogicasG2[5] = {5, 6, 7, 8, 9}; 
int giValActualG1[5];
int giValActualG2[5];
int giValActualG100[5];
int giValActualG200[5];
int giValActualG1XX[5];
int giValActualG2XX[5];
double gdPendienteG1[5];
double gdPendienteG2[5];
int giOffSetG1[5];
int giOffSetG2[5];
int giIndCalibrando =0;
int giIndCalibrado =0;
int giComodinfor=1;
int giAddress = 0;
int giPosEntrada = 0; 
double gdAuxG1 [5][5]; 
double gdAuxG2 [5][5]; 
int p;
String gsMenRecibido="";
String gsMenEnviar="";
EthernetServer server(serverPort);
void setup()
{
  Serial.begin(9600);// start the serial for debugging 
  Ethernet.begin(mac, ip);// start the Ethernet connection and the server:
  Wire.begin(); // Establece la velocidad de datos del bus I2C
  RTC.begin(); // Establece la velocidad de datos del RTC
  server.begin();
  pinMode(PinSA1, OUTPUT);
  pinMode(PinAA1, OUTPUT); 
  pinMode(PinSB2, OUTPUT); 
  for(p=0;p<5;p++) // Configuracion de todos los pines digitales como salida
  {
     pinMode(giPinA[p], OUTPUT);
     pinMode(giPinB[p], OUTPUT); 
     giIndCalibrado = EEPROM.readInt(giAddress);
    if (giIndCalibrado == 1)
     {
       gdPendienteG1[p] = EEPROM.readFloat(giAddress+1+(p*12));
       gdPendienteG2[p] = EEPROM.readFloat(giAddress+5+(p*12));
       giOffSetG1[p] = EEPROM.readInt(giAddress+9+(p*12));
       giOffSetG2[p] = EEPROM.readInt(giAddress+11+(p*12));
     }
     else 
     {
       gdPendienteG1[p] = 1; //valores sin ajustar
       gdPendienteG2[p] = 1; //valores sin ajustar
       giOffSetG1[p] = 0;     
       giOffSetG2[p] = 0;     
     }
  }
}
/****************************** FUNCION TRANSFORMA ANGULOS EN GRADOS ************************************/ 
int TransAnGra(int EntradaRec, double pdPendiente, int piOffset, int I, int E)
{ 
  double ldXG1 = 0;
  double ldXG2 = 0;
  double ldValor;
  int valor;
  if (pdPendiente ==  1 && piOffset == 0)
  {
    ldValor = analogRead(EntradaRec); 
  }
  else 
  {
    if (E == 1) 
    {
      gdAuxG1 [I][giPosEntrada] = analogRead(EntradaRec); 
      giPosEntrada++;  
      if(giPosEntrada == 4) 
        giPosEntrada = 0; 
      for (p=0; p<5; p++)
        ldXG1= ldXG1 + gdAuxG1 [I][p]; 
      ldXG1= ldXG1 / 5;  
      ldValor  = ldXG1;  
    }
    else if (E ==2) 
    {
      gdAuxG2 [I][giPosEntrada] = analogRead(EntradaRec);
      giPosEntrada++;  
      if(giPosEntrada == 4)
        giPosEntrada = 0; 
      for (p=0; p<5; p++)
        ldXG2= ldXG2 + gdAuxG2 [I][p];    
      ldXG2= ldXG2 / 5;  
      ldValor = ldXG2;
    }
  }
  valor =(int)(ldValor* pdPendiente) + piOffset; 
  return valor;
}
/*********************************** FUNCION ITERACCIONA CON LOS INCLINOMETROS************************************/ 
int FRecuperaValoresInclinometros()
{
  for(p=0;p<5; p++) 
  {
      giValActualG1[p] = TransAnGra(giEAnalogicasG1[p], gdPendienteG1[p], giOffSetG1[p], p, 1);   
      giValActualG2[p] = TransAnGra(giEAnalogicasG2[p], gdPendienteG2[p], giOffSetG2[p], p, 2);   
  } 
  if(giComodinfor)
      giComodinfor=0;
  return 0;
}
/************************************* FUNCION ENVIA MENSAJES ***********************************************/ 
int FEnviaMensaje()
{
  Serial.println("Enviando Message");
  int i=0;
  server.print(gsMenEnviar);
  Serial.println(gsMenEnviar);
  return 0;  
}
/*********************************************** FUNCION TRATA MENSAJES ****************************************/ 
int TrataMensajeRecibidoTCP()
{
  Serial.println("entro a funcion de trata de mensajes");
  int liRet = 0;
  int i=0;
  int liValor = 0;
  String lsAux = "";
  int liAddress = 0;
  Serial.println("FEnviaMensaje");    
    if (gsMenRecibido[0] == '1' && gsMenRecibido[1] == '9')
    {
      if (gsMenRecibido[2] == 'S') 
      {
         if (gsMenRecibido[3] == 'F') 
         {
              if (gsMenRecibido[4] == 'R') 
                     gsMenEnviar = "#RESET@"; 
              else      
                  gsMenEnviar = "#RESET OK@";   
         }
     }
     if (gsMenRecibido[2] == 'T') 
     {
        if (gsMenRecibido[3] == 'S') 
          gsMenEnviar = "#SETEO HORA@";
        else
           gsMenEnviar = "#SUMINISTRANDO HORA@";
    }
    if (gsMenRecibido[2] == 'D') 
    {
        if (gsMenRecibido[3] == 'D') 
            gsMenEnviar = "#PREGUNTO INFO@";
        else    
              gsMenEnviar = "#DR@";
    }  
   if (gsMenRecibido[2] == 'C') 
   {
         if (gsMenRecibido[3] == 'P')
         {
             giIndCalibrando = 1;
             if (giIndCalibrando == 1) 
             {
                 for (p=0; p<5; p++)
                 {
                     digitalWrite(giPinA[p], LOW);
                     digitalWrite(giPinB[p], LOW);
                 }
                 digitalWrite(PinAA1, LOW);
                 digitalWrite(PinSA1, LOW);
                 digitalWrite(PinSB2, LOW);
            }     
           gsMenEnviar = "#CALIBRANDO@"; 
         }
         if (gsMenRecibido[3] == 'A') 
         {
                gsMenEnviar = "#CA";
                for (i=0; i < 5; i++)
                {
                    giValActualG100[i] = TransAnGra(giEAnalogicasG1[i], 1, 0, i, 1);
                    giValActualG200[i] = TransAnGra(giEAnalogicasG2[i], 1, 0, i, 2);
                    gsMenEnviar += String(giValActualG100[i]) + "," + String(giValActualG200[i]) + ",";
                }
                gsMenEnviar += "@";
         }
         if (gsMenRecibido[3] == 'B') 
         {        
                lsAux = String(gsMenRecibido[4]) + String(gsMenRecibido[5]);  
                liValor = lsAux.toInt();
                Serial.println(String(liValor));
                gsMenEnviar = "#CB";
                for (i=0; i < 5; i++)
                {
                    giValActualG1XX[i] = 5;
                    gdPendienteG1[i] = (double)liValor / (double)(giValActualG1XX[i] - giValActualG100[i]) ;
                    giOffSetG1[i] = - (gdPendienteG1[i] * giValActualG100[i]);
                    gsMenEnviar += String(giValActualG1XX[i]) + "," + String((int)gdPendienteG1[i]) + "," + String(giOffSetG1[i]) + ",";
                }
                gsMenEnviar += "@";
         }
         if (gsMenRecibido[3] == 'C') 
         {        
                lsAux = String(gsMenRecibido[4]) + String(gsMenRecibido[5]);                
                liValor = lsAux.toInt();
                gsMenEnviar = "#CC";
                for (i=0; i < 5; i++)
                {
                    giValActualG2XX[i] = 1;
                    gdPendienteG2[i] = (double)liValor / (double)(giValActualG2XX[i] - giValActualG200[i]) ;
                    giOffSetG2[i] = - (gdPendienteG2[i] * giValActualG200[i]);
                    gsMenEnviar += String(giValActualG2XX[i]) + "," + String((int)gdPendienteG2[i]) + "," + String(giOffSetG2[i]) + ",";
                }
                gsMenEnviar += "@";
         }
         if (gsMenRecibido[3] == 'I') 
         {
                  gsMenEnviar = "#CI";
                  for (i=0; i < 5; i++)
                  {
                        giValActualG1[i] = TransAnGra(giEAnalogicasG1[i], gdPendienteG1[i], giOffSetG1[i], i, 1);
                        gsMenEnviar += String(giValActualG1[i]) + "=(";
                        liValor = TransAnGra(giEAnalogicasG1[i], 1, 0, i, 1);
                        gsMenEnviar += String(liValor) + "*" + String((int)gdPendienteG1[i]) + ")+" + String(giOffSetG1[i]) + ";";
                        giValActualG2[i] = TransAnGra(giEAnalogicasG2[i], gdPendienteG2[i], giOffSetG2[i], i, 2);
                        gsMenEnviar += String(giValActualG2[i]) + "=(";
                        liValor = TransAnGra(giEAnalogicasG2[i], 1, 0, i, 2);
                        gsMenEnviar += String(liValor) + "*" + String((int)gdPendienteG2[i]) + ")+" + String(giOffSetG2[i]) + ";";
                  }
                  gsMenEnviar += "@";
         }      
         if (gsMenRecibido[3] == 'S')
         {
             EEPROM.writeInt(giAddress, 1);
             giIndCalibrado = 1;
             for (i=0; i<5 ; i++)
             {
                  EEPROM.writeFloat(giAddress+1+(i*12), gdPendienteG1[i]);
                  EEPROM.writeFloat(giAddress+5+(i*12), gdPendienteG2[i]);
                  EEPROM.writeInt(giAddress+9+(i*12), giOffSetG1[i]);
                  EEPROM.writeInt(giAddress+11+(i*12), giOffSetG2[i]);
              }         
              gsMenEnviar = "#EEPROMOK@"; 
              giIndCalibrando = 0;
         }      
     }       
  }
  else
  {
     gsMenEnviar = "#ERROR MENSAJE@";
     liRet = -1;
  }
  FEnviaMensaje();
  return liRet;  
}
/****************************************** FUNCION ATIENDE PETICIONES *********************************/ 
int FAtiendePeticionesTCP()
{
  int liRet = 0;
  char c ;  
  gsMenRecibido="";
  EthernetClient client = server.available(); 
  if (client)
  {
    if (client.connected()) 
    {
          Serial.println("cliente conectado");
          while ((client.available()) ) 
          {      
              c = client.read();        
              if (c == '#') 
              {
                gsMenRecibido = "";
                Serial.println("mensaje: #");          
              }
              else if ( c == '@')
              {
                liRet = TrataMensajeRecibidoTCP();
                Serial.println("mensaje: " + gsMenRecibido);          
                client.flush();
                client.stop();
              }
              else 
              {
                gsMenRecibido+=c;                     
              }
          }
    } 
  }
  return liRet;
}
/******************** FUNCION PRINCIPAL O "MAIN" *********************************************************/ 
void loop()
{
  int liRet = 0;  
  if (giIndCalibrando == 0)  // Si no se para remotamente, el programa continua su flujo
  {
    Serial.println ("primer paso");
    liRet = FRecuperaValoresInclinometros();
    Serial.println ("segundo paso");
  }
  liRet = FAtiendePeticionesTCP();
}
void loop()
{
  int liRet = 0;  
  if (giIndCalibrando == 0)  // Si no se para remotamente, el programa continua su flujo
  {
    Serial.println ("primer paso");
    liRet = FRecuperaValoresInclinometros();
    Serial.println ("segundo paso");
  }
  liRet = FAtiendePeticionesTCP();
}

liRet is a local variable. Nowhere do you seem to care what value is in it, so get rid of it.

but if I leave this if the programming stop its execution.

So, add some Serial.print() statements to FRecuperaValoresInclinometros(), to determine why it doesn't return.

Thanks for your reply. The problem of FRecuperaValoresInclinometros() is when this function call to TransAnGra(). I know this because I have finished to try the same code without this callings and all goes correct. However if I leave the callings the problem continue.
I don't understand the problem with this funtion TransAnGra(). Do you see anything wrong? Because I think it's strange.

Good morning PaulS !!

I have continued investigating the problem, and now I could see that the return of function TrataMensajeRecibidoTCP() doesn't run correctly because doesn't return the value (liRet) and for this reason, the process stops expecting the return. Only this is correct with the message #19T@, for this reason, I don't understand the problem because I think that all the messages are treated of the same form.
Can you help me out? You can see that I am new with Arduino and I don't have much experience with this problems.
Thank you for your help!!