01-31-2023, 05:32 PM
Hey Guys,
I know there has already been an answer to this issue but still it doesnt work for me.
When doing it exactly as in the example:
https://virtuino.com/forum/showthread.ph...text+value
It just doesnt display a text. Dumbers work fine but String doesnt work at all...
String text1="Hello"; //Declare some variable for the text. On Virtuino use the pin V32
String text2=""; // V33
String text3=""; // V34
//============================================================== onCommandReceived
//==============================================================
/* This function is called every time Virtuino app sends a request to server to change a Pin value
* The 'variableType' can be a character like V, T, O V=Virtual pin T=Text Pin O=PWM Pin
* The 'variableIndex' is the pin number index of Virtuino app
* The 'valueAsText' is the value that has sent from the app */
void onReceived(char variableType, uint8_t variableIndex, String valueAsText){
if (variableType=='V'){
float value = valueAsText.toFloat(); // convert the value to float. The valueAsText have to be numerical
if (variableIndex<V_memory_count) V[variableIndex]=value; // copy the received value to arduino V memory array
else if (variableIndex==32) text1=valueAsText; // V32 -> Text
else if (variableIndex==33) text2=valueAsText; // V33 -> Text
// else if (variableIndex==34) text3=valueAsText; // V34 ->Text
}
}
}
//==============================================================
/* This function is called every time Virtuino app requests to read a pin value*/
String onRequested(char variableType, uint8_t variableIndex){
if (variableType=='V') {
if (variableIndex<V_memory_count) return String(V[variableIndex]); // return the value of the arduino V memory array
else if (variableIndex==32) return text1; // V32 -> Text
else if (variableIndex==33) return text2; // V33 -> Text
// else if (variableIndex==34) return text3; // V34 ->Text
}
return "";
}
Should the text value display now display "Hello" if i declare it to be V[32]?
Or do I need to call it somehow to declare that V[32] should display the string text1 in the text value display any other way than virtuinoRun(); ?
Thanks for the Help!
I know there has already been an answer to this issue but still it doesnt work for me.
When doing it exactly as in the example:
https://virtuino.com/forum/showthread.ph...text+value
It just doesnt display a text. Dumbers work fine but String doesnt work at all...
String text1="Hello"; //Declare some variable for the text. On Virtuino use the pin V32
String text2=""; // V33
String text3=""; // V34
//============================================================== onCommandReceived
//==============================================================
/* This function is called every time Virtuino app sends a request to server to change a Pin value
* The 'variableType' can be a character like V, T, O V=Virtual pin T=Text Pin O=PWM Pin
* The 'variableIndex' is the pin number index of Virtuino app
* The 'valueAsText' is the value that has sent from the app */
void onReceived(char variableType, uint8_t variableIndex, String valueAsText){
if (variableType=='V'){
float value = valueAsText.toFloat(); // convert the value to float. The valueAsText have to be numerical
if (variableIndex<V_memory_count) V[variableIndex]=value; // copy the received value to arduino V memory array
else if (variableIndex==32) text1=valueAsText; // V32 -> Text
else if (variableIndex==33) text2=valueAsText; // V33 -> Text
// else if (variableIndex==34) text3=valueAsText; // V34 ->Text
}
}
}
//==============================================================
/* This function is called every time Virtuino app requests to read a pin value*/
String onRequested(char variableType, uint8_t variableIndex){
if (variableType=='V') {
if (variableIndex<V_memory_count) return String(V[variableIndex]); // return the value of the arduino V memory array
else if (variableIndex==32) return text1; // V32 -> Text
else if (variableIndex==33) return text2; // V33 -> Text
// else if (variableIndex==34) return text3; // V34 ->Text
}
return "";
}
Should the text value display now display "Hello" if i declare it to be V[32]?
Or do I need to call it somehow to declare that V[32] should display the string text1 in the text value display any other way than virtuinoRun(); ?
Thanks for the Help!