B4R Question ByteConverter.Doubles to Bytes

Status
Not open for further replies.

DARintoul

Member
Licensed User
Longtime User
Please advise error in the following snippet:-

Dim celsius As Double = 20.75
Dim AVal() As Byte = Array As Byte(BC.DoublesToBytes(celsius))
or
Dim AVal(4) As Byte = BC.DoublesToBytes(celsius))

and other variants!

Regards
Donald
 

DARintoul

Member
Licensed User
Longtime User
Thanks Erel
However I now have the reverse problem - see code
B4J Code
Private Sub DisplayTemperatures(Payload() As Byte)
' Display Payload contents
Dim B As Byte
For i = 0 To Payload.Length-1
B = Payload(i)
Log(B)
Next
' Test Display Double
Dim D As Double = 20.925 ' Test
Log(NumberFormat(D,0,2)) ' Test
' Covert to Double and display
Dim Buffer() As Double = bc.DoublesFromBytes(Payload)
Dim E As Double = Buffer(0) ' Produces Error
Log(NumberFormat(E,0,2))
End Sub

Log
0
-128
-89
65
20.93
Error occurred

Your help is appreciated! Donald
 
Upvote 0
Status
Not open for further replies.
Top