convert text to integer in arduino code example
Example: arduino string to int
void loop() {
Serial.readBytes(mystr,5); //Read the serial data and store in var
//delay(1000);
String val = mystr;
int i = val.toInt();
int num = i + i;
Serial.println(num);
}