B4J Question Convert signed byte to int

Philip Prins

Active Member
Licensed User
Longtime User
Hello ,

I get a HEX value that is a temperature reading 16 Hex is 22 degrees.
But when the temperature = -15 the HEX value is F0

How can i convert this HEX value to -15?

Tnx in advance
Philip
 

stevel05

Expert
Licensed User
Longtime User
Assign the value to a byte first, although F0 should be -16.

B4X:
  Dim H As String = "F0"
    Dim b As Byte = Bit.ParseInt(H,16)
    Log(b)
 
Upvote 0
Top