How to send float with terminal

Hi everyone !
I need some help to change some float variable in my code : I want to send value from blynk to my mkr1000 and then, read those value and put them into some float variable. For this, I use terminal. First, I send a text like “variableA” to select which variable I want to modify, and then I would like to send, for exemple 20.1 and put this to a float. the code I use for now (only the important part)

BLYNK_WRITE(V1)
{
    if(String("variableA") == param.asStr())
  {
    terminal.println("Value?");
    terminal.flush();

  }

  else if(String("variableB") == param.asStr())
  {
    terminal.println("Value?");
    terminal.flush();
}

I was thinking to use something like I do with Serial

while(!Serial.available){}

but there is no

terminal.available()

Thanks for help !

@BarfedBean you want to send a float from Terminal to your device and your device to use that float, right?

If that is the case maybe this works for you:

BLYNK_WRITE(V1)  // Terminal Widget
{
  String stringTerminal = param.asStr();  // get data entry from Terminal
  float floatTerminal = stringTerminal.toFloat();
  floatTerminal = floatTerminal + 12.3;  // add a float to the 'number' entered into Terminal
  char buffer[10];
  stringTerminal =  dtostrf(floatTerminal,5, 2, buffer);  // width and precision
  
  if(floatTerminal > 20)
  {
    terminal.println("Sum is over 20"); // some random text
    terminal.flush();
  }

  else
  {
    terminal.println(stringTerminal); // show in Terminal the result of the float entered into Terminal plus 12.3
    terminal.flush();
  }
}
1 Like