How store values of keypad arduino in an variable for realizing an calculation

Hi,
I'm beginner with arduino, so sorry if i do a stupid question. I have to do a project with arduino using a solenoide and keypad 4x4.
I want take the numbers entered by the user and store these nubmbers in an variable. I will take multiply this numbers for 1000, putting the result in the delay time.
this time of delay is the time of the solenoide stay open, but in this case i test with led 13 of arduino. But i can't do this, my code is not working,
i need help for this project, please :frowning:

Here is my code

#include <Keypad.h>
String acumulado = " ";
float tempo, dlay;
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS] [COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','D'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {2,3,4,5}; // saida das linhas
byte colPins[COLS] = {6,7,8,9}; //saida das colunas
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup(){
Serial.begin(9600);
Serial.println("Digite a quantidade de agua desejada");
}
String descarga(){
char key = keypad.getKey();
switch(key){
case NO_KEY:
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case 'B': case 'C': case 'D':
Serial.print(key);
acumulado.concat(key);
break;

case '*':
Serial.print(key);
acumulado.concat(key);
tempo = acumulado.toFloat();
dlay = tempo * 1000;
if(key == 'A'){

digitalWrite(13, HIGH);
delay(dlay);
digitalWrite(13, LOW);
delay (dlay);
}
acumulado = " ";
break;

case '#':
Serial.print(key);
acumulado.concat(key);
acumulado = " ";
break;

}
}

void loop() {
// put your main code here, to run repeatedly:
char key = keypad.getKey();
Serial.print(key);
descarga();

}

acumulado.concat(key);

Why? You got a '0' to '9'. Subtract '0' from that value, and what do you have? Yep, 0 to 9.

Now, how do you get from 12 to 127 when the 7 arrives? Multiply by 10 and add 7.

No need to piss away resources using the wasteful String class.

case '#':
      Serial.print(key);
      acumulado.concat(key);

Why would you want to put the # on the end of the String "127"? Parsing it just got a lot harder.

  char key = keypad.getKey();
  Serial.print(key);

Throw away random keypresses. Why does this seem like a good idea?

Sorry, i don't understand , what you recommends to do?