Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Display ASCII characters on dashboard
#2
Hi,
you have to add a java script code.
1. Read all the variables from the script. 
2. Convert the alues to characters
3. Create a text from the charactes.
4. Write the text to a new Variable

Please check the attached image. I have created an example.
In this example the variables V1-V5 contains the numbers 65,66,67,68,69
The result to V10 is the text: ABCDE

Code:
//--- Copy values from Virtuino Variables to JavaScript variables
var inputValue1 =+Virtuino.readValue("inputTag1");   //Read inputTag1 value as number from V1.       
var inputValue2 =+Virtuino.readValue("inputTag2");   //Read inputTag2 value as number from V2     
var inputValue3 =+Virtuino.readValue("inputTag3");   //Read inputTag3 value as number from V3     
var inputValue4 =+Virtuino.readValue("inputTag4");   //Read inputTag4 value as number from V4     
var inputValue5 =+Virtuino.readValue("inputTag5");   //Read inputTag5 value as number from V5     

//---  enter the JavaScript code like the example below

  var char1 = String.fromCharCode(inputValue1);                     
  var char2 = String.fromCharCode(inputValue2);                     
  var char3 = String.fromCharCode(inputValue3);                     
  var char4 = String.fromCharCode(inputValue4);                     
  var char5 = String.fromCharCode(inputValue5);         
  var text = char1+char2+char3+char4+char5;             
  result = '{"tag":"outputTag", "value":"'+ text+ '"}'; //  return a json message   


Attached Files Thumbnail(s)
       
Reply


Messages In This Thread
Display ASCII characters on dashboard - by slabit - 12-01-2023, 09:31 PM
RE: Display ASCII characters on dashboard - by iliaslamprou - 12-03-2023, 08:58 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)