Virtuino Forum

Full Version: Text value display
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

for some reason I can't address text memory (T pins) for the text value display widgets in version 6.0.18 . I'm using the VirtuinoCM library and a WEMOS D1 R1 ESP8266 board.

I need to transfer a string value which basically contains a time stamp as text. 

Any hints would be appreciated.

Cheers, 

Mat 

[attachment=11]
Hi, 
the solution is to download the version 6.0.08 from Virtuino web site
https://virtuino.com/index.php/2-uncateg...tuino-apks
Hi Ilias,

that's what I did for a work-around. Is this going to be fixed in a newer version? Just noticed that you released 6.0.19.

By the way, could you please explain briefly how I can use M-pins in Arduino IDE. It looks like, that this function wasn't included in the VirtuinoCM library. 

I want to alter the background color of a frame widget, but I cant address the M pins directly. I tried to get arround with converting a virtual pin into a memory pin using your in-built converting sketch tools. However, that wasn't successful at all. 

Any solutions would be appreciated. 

Cheerio,

Mat
Hi Mat,

no,  the T pins are no longer supported
You have to use the Vpins for any type of variables
There is an example on the Virtuino web site examples
https://virtuino.com/downloads/examples/...y_text.zip

The M pins are internal variables that you can use inside the app only.
They are usefull for calculation, dashboard changing ect.

You can copy a Vpin to a Mpin. Use the widget "Script".

for example: 
Using the widget "Script", enter as script the parameter x only
Enter as input the arduino V variable
Enter as output an M variable
(07-13-2022, 12:29 AM)Hi Ilias,thank you for your advice. Not sure if it's beneficial to use only the V-pins. Most of the data are integers and floats, which then needs to be converted to strings. Using strings can clog up your memory very fast. Having the extra T pins for text values was initially a great idea.Anyway, there are still some nice improvements in comparison to version 6.0.08 and I'll see how I get on with it.Thanks again for your great work!Mat Wrote: [ -> ]Hi Mat,

no,  the T pins are no longer supported
You have to use the Vpins for any type of variables
There is an example on the Virtuino web site examples
https://virtuino.com/downloads/examples/...y_text.zip

The M pins are internal variables that you can use inside the app only.
They are usefull for calculation, dashboard changing ect.

You can copy a Vpin to a Mpin. Use the widget "Script".

Using the widget "Script", enter as script the parameter x only
Enter as input the arduino V variable
Enter as output an M variable
Hi, 
you don't need to convert you integer or float values to Strings.

You have add code only here, it is very simple:

Code:
String text1="";  //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 "";
}
Hi Ilias,

that was the missing part!!! Spot on. [Image: thumbsup.png]

If you can tell me now how to get rid of the CMError E00=7$, you will definitely be the hero of the week.

All the best,

Mat
Hi,


you have to select the VirtuinoCM library in the Virtuino server settings

[Image: virtuino_server_settings.png]
Hi Ilias,

the communication is up on running. I also downloaded the latest version of the VirtuinoCM library. It happens occasionally after 3-4 successful data transfers. Please see the screen shot below. During this time I can't submit any values to the controller. Sometimes I need multiple attempts to change a single parameter. It's causing the whole communication to slow down. 


Latest info:
Problem solved within the controller sketch.

Fighting hard with the text script widget. I want to compare two V-pin values (>=;=; etc) and give the result to a memory variable. I don't understand the example at all. Do you have a decent description of it? Would be great to have a widget similar to the logic gates for comparing operations.
No, you can't compare variables.
You can compare a variable value with a constant value only.

This feature is added to Virtuino IoT version