Asked — Edited
Resolved Resolved by DJ Sures!

How To Convert Integer To Hex

I wish to convert an integer to Hex. For instance, if I subtract one Hex value from another Hex value, the result is an integer. I would like to get the Hex value of that integer.

Here is the code I have tried:


$val = (0xff - 0x28)
print($val)

$hex = ToHex($val)
print($hex)

The results I get are: start 1: $val = (0xff - 0x28) 2: print($val) >215

The results I want are: $hex = 0xD7


ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

#1  

How about this command edit never mind, I see you know of the command already


$hex=ToHex( value ) #converts an integer  to hex

PRO
Synthiam
#2  

Thanks - I found that PrintHex() has a bug because it prints each digit of the value. It's fixed for next release.

PRO
Synthiam
#4  

It'll probably be midnight tonight. I've been working on an update that stores the example projects in an All Users folder for public sharing between accounts. It's been requested by schools to share the examples folder - so hopefully that'll be done by this evening and will include your fix

PRO
Synthiam
#5  

Latest release fixes PrintHex()

Release notes: https://synthiam.com/Community/Questions/7596