hello i’m new i just want to send data form nodeMcu to terminal in blynk. i try not to use cases statement but the result same as if else statement
this my program
else if (String("/3") == param.asStr())
{
terminal.println(F("-----air temperature-----"));
terminal.println(F("constant value or flow value"));
terminal.println(F("type 'yes' or 'no'"));
terminal.flush();
if(String("/yes") == param.asStr())
{
test_2=1;
}
else if(String("/no") == param.asStr())
{
test_2=2;
}
switch(test_2)
{
case 1:
{
byte t = dhtA.readTemperature();
Blynk.virtualWrite(V3, t);
}
break;
case 2:
{
byte t = dhtA.readTemperature();
Blynk.virtualWrite(V3, t);
}
break;
}
else
{
terminal.print(F("type'/help' for more info"));
terminal.println();
}
terminal.flush();
}
}
I’ve added triple backticks at the beginning and end of your code, so that it displays correctly.
Please do this yourself in future otherwise your code will be deleted.
Triple backticks look like this:
```
Your snippet of code makes no sense, as it begins with an else if statement, so it’s impossible to tell what the rest of the if statement looks like.
However, the rest of your if statements, and your switch case statement are nestled inside this else if statement.
please post your full code (with backticks) and explain the functionality that you’re trying to achieve.