Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Javascript: dec to hex + slicing
#3
Thank you for your help.

I got something figured out.
When I first convert the long(64-bit) with your int -hex converter, I get the correct number, however I have some zeroes to much.

After this I can use this code to remove the 4 zero's.

Code:
//--- Copy values from Virtuino Variables to JavaScript variables
var inputValue = Virtuino.readValue("inputTag");        // read a Virtuino variable as String
 var hex = inputValue.toString(16);
//---  enter the JavaScript code like the example below
var value = hex.slice(0,-4);
result = '{"tag":"outputTag", "value":"'+ value+ '"}';    // return a json. Enter as "tag" the output tag you want to store the value
Reply


Messages In This Thread
Javascript: dec to hex + slicing - by Dkyndt - 04-19-2023, 09:02 PM
RE: Javascript: dec to hex + slicing - by Dkyndt - 04-20-2023, 06:50 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)