Read Serial

I read from serial and don't work correctly, if i use the interface of arduino yes but when i write from the pc don't. I think the char I read is codific in UTF-8, how I can convert to Ascii string for a correct work?

while(Serial.available()){
    entrada[contentrada++]= Serial.read();
    if(contentrada == 3){ contentrada = 0;    }
   }
   if(strcmp(entrada,"ava")==0){
    
    analogWrite(motorizqa,155);
  }

You can't use "strcmp" because you haven't made a string. A string is a char array with zero after the last valid character

char array [4];

array [0] = 'a';
array [1] = 'v';
array [2] = 'a';
// array is not a string
array [3] = '\0'; // now it is!

If you are using the serial monitor to send data to the Arduino, the data is sent in ASCII as a series of characters.

When you read those characters, and store them in an array, as you are doing, you are NOT creating a string that can be passed to strcmp.

If, after adding the character read from the serial port to the array, you added a NULL terminator in the next position, you WOULD be creating a string that can be passed to the strcmp function.

while(Serial.available()){
    entrada[contentrada++]= Serial.read();
    [glow]entrada[contentrada] = '\0';[/glow]
    if(contentrada == 3){ contentrada = 0;    }
   }
   if(strcmp(entrada,"ava")==0){

Paul, does this solve the problem I posted in my other thread? http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279511079/all

Paul, does this solve the problem I posted in my other thread?

Sorry, my crystal ball is out for cleaning.

Try it and see.