invalid conversion from 'char (*)[50]' to 'char'

Hello all! Sorry about my english.

I'm trying to do a sketch that definetly receive a string with some protocol and convert diferent values for doing anything.

The protocol is, start: "[" end:"[". So I can send [V180] and refresh my vertical servo angle, or [H100] and refresh my horizontal servo angle too. But not at the same time. You should send one and after the another.

This is the code (working):

#define baudRate 9600
#define VERDADEIRO 1  
#define FALSO 0 

char Texto[50];
char *Ponteiro_Texto;
char ucInicial = 0;
   
void setup(){
  
  Serial.begin(baudRate);
  
}

void loop(){

    while (Serial.available() > 0){
      unsigned char ucRecebe;
     ucRecebe = Serial.read();         // Read data
     if (ucRecebe == '['){             // verify start
         ucInicial = VERDADEIRO;       // Protocol stars here....
         Ponteiro_Texto = Texto;      // restart pointer
     }else if (ucInicial == VERDADEIRO){        // start receive?
         *Ponteiro_Texto = ucRecebe;   // accept data
         Ponteiro_Texto++;             // pointer ++
     }

     if (ucRecebe == ']'){              // verify end
        decodificaSerial();             // execute decodificaSerial
        ucInicial = FALSO;              // Wait for new starter
     }
    }
}
      
void decodificaSerial(){
  
  int posicaoVertical;
  int posicaoHorizontal;
  
  switch (Texto[0])
  {
    case 'V':
    posicaoVertical = atoi(Texto + 1);
    Serial.print("Angulo servo Vertical: ")  ;Serial.println(posicaoVertical);      
    posicaoVertical = 0;
    break;
    
    case 'H':
    posicaoHorizontal = atoi(Texto + 1);
    Serial.print("Angulo servo Horizontal: ");Serial.println(posicaoHorizontal);
    posicaoHorizontal = 0;
    break; 
  }
 
    Serial.flush();                      //Limpa buffer Serial para novo tratamento
}

But the original in a MICROCHIP PIC18F i use this line: Ponteiro_Texto = &Texto; If i tried to use this with Arduino, returns the error:
tratamento_serial.cpp: In function 'void loop()':
tratamento_serial:22: error: invalid conversion from 'char (*)[50]' to 'char'

The code should be:

#define baudRate 9600
#define VERDADEIRO 1  
#define FALSO 0 

char Texto[50];
char *Ponteiro_Texto;
char ucInicial = 0;
   
void setup(){
  
  Serial.begin(baudRate);
  
}

void loop(){

    while (Serial.available() > 0){
      unsigned char ucRecebe;
     ucRecebe = Serial.read();         // Read data
     if (ucRecebe == '['){             // verify start
         ucInicial = VERDADEIRO;       // Protocol stars here....
         [color=#ff0000]Ponteiro_Texto = &Texto;      // restart pointer[/color]
     }else if (ucInicial == VERDADEIRO){        // start receive?
         *Ponteiro_Texto = ucRecebe;   // accept data
         Ponteiro_Texto++;             // pointer ++
     }

     if (ucRecebe == ']'){              // verify end
        decodificaSerial();             // execute decodificaSerial
        ucInicial = FALSO;              // Wait for new starter
     }
    }
}
      
void decodificaSerial(){
  
  int posicaoVertical;
  int posicaoHorizontal;
  
  switch (Texto[0])
  {
    case 'V':
    posicaoVertical = atoi(Texto + 1);
    Serial.print("Angulo servo Vertical: ")  ;Serial.println(posicaoVertical);      
    posicaoVertical = 0;
    break;
    
    case 'H':
    posicaoHorizontal = atoi(Texto + 1);
    Serial.print("Angulo servo Horizontal: ");Serial.println(posicaoHorizontal);
    posicaoHorizontal = 0;
    break; 
  }
 
    Serial.flush();                      //Limpa buffer Serial para novo tratamento
}

Anyone for this error?

Thx in advance and soooo sorry about the english!! hahahaha ;D

You don't really need Ponteiro_Texto. Just create a index variable:

byte index = 0;

Then, where you have:

Ponteiro_Texto = Texto;

put:

Texto[0] = '\0';
index = 0;

And where you have:

*Ponteiro_Texto = ucRecebe;   // accept data
       Ponteiro_Texto++;

use:

Texto[index] = ucRecebe;
index++;
Texto[index] = '\0';

Get rid of this code:

    Serial.flush();                //Limpa buffer Serial para novo tratamento

If some serial data arrived on the port while you were parsing the previous data, you'd throw it away. That's not a good thing to do.

Once you know what the first letter is, change that letter to a '0'.

Texto[0] = '0';

Then, call atoi with Text0.

posicaoHorizontal = atoi(Texto);