I am trying to input few Strings and int from terminal.
Like
if (String("ADD") == param.asStr()) {
// function();
}
This is working fine. But later i will have to input number like 1-25.
But the function accepts only ```int``` not ```String```. So is there a way like once i enter ADD and later when the function is called i should be able to input the 1-25 as int.
String tInput; - for alphabets.
int cInput; - for 1-25
How to tell the terminal that i am sending input as ```int``` ??
Probably much easier to grab everything as a string then handle it from there, extracting the numeric parts with string manipulation.
Youâd need to add an âadd flagâ which is set to true if the last data from the terminal was âADDâ and which then tells you to expect the next data from the terminal to be a numeric range. Once youâve verified that it is, then you can split the numbers out of the string and handle them as you wish.
I thought of it⌠But i wanted to know if there was a better way of doing it. I thought placing a flag is a crude method.
i tried String input; int = xyz; xyz = input.toInt();
without any successâŚ
BLYNK_WRITE(V10) {
int num = param.asInt();
num = ID;
Serial.println(ID);
Serial.println(num);
}
V10 is for terminal input. Whatever value(numbers) i send from the terminal widget, it returns â0â in the serial monitor. Can anyone tell me what is wrong ?
Look at your code.
num is being set to the value from the terminal widget.
This is then being replaced with the value of ID (which youâve defined as zero)
You are then printing both num and ID, which are both zero.