Hello, I’m very beginner in C++, I added Terminal widget to V2 pin
Instead of using Switch for choosing options I’ve used if to send a word to Terminal in Blynk app. Because I don’t have any idea for reading input from Terminal in Blynk app hehe. and also using If function is more flexible I think.
Here is my code :
` BLYNK_WRITE(V2){
` if (String("clr") == param.asStr()) {
` Blynk.virtualWrite(V2,"clr");}
` else
` {Blynk.virtualWrite(V2," Please type correct input !!! , Moving to homepage in 3s");
` delay(3500);
` {return;}}}
` BLYNK_WRITE_2(V2){
` if (String("A"),("a") == param.asStr()) {
` Blynk.virtualWrite(V2,"");
` Blynk.virtualWrite(V2,"TEST A");}
` else
` {Blynk.virtualWrite(V2," Please type correct input !!! , Moving to homepage in 3s");
` delay(3500);
` {return;}}}`
I’ve successfully compiled the code without error, but when I want to add some if function.
` BLYNK_WRITE(V2){
` if (String("clr") == param.asStr()) {
` Blynk.virtualWrite(V2,"clr");}
` else
` {Blynk.virtualWrite(V2," Please type correct input !!! , Moving to homepage in 3s");
` delay(3500);
` {return;}}}
` BLYNK_WRITE_2(V2){
` if (String("A"),("a") == param.asStr()) {
` Blynk.virtualWrite(V2,"");
` Blynk.virtualWrite(V2,"TEST A");}
` else
` {Blynk.virtualWrite(V2," Please type correct input !!! , Moving to homepage in 3s");
` delay(3500);
` {return;}}}
` BLYNK_WRITE_3(V2){
` if (String("B"),("b") == param.asStr()) {
` Blynk.virtualWrite(V2,"");
` Blynk.virtualWrite(V2,"TEST A");}
` else
` {Blynk.virtualWrite(V2," Please type correct input !!! , Moving to homepage in 3s");
` delay(3500);
` {return;}}}
` BLYNK_WRITE_4(V2){
` if (String("C"),("c") == param.asStr()) {
` Blynk.virtualWrite(V2,"");
` Blynk.virtualWrite(V2,"TEST A");}
` else
` {Blynk.virtualWrite(V2," Please type correct input !!! , Moving to homepage in 3s");
` delay(3500);
` {return;}}}`
I compiled it and get this error :
Preformatted text expected constructor, destructor, or type conversion before '(' token
What should I do? or anyone have a better suggest for my code?