B4R Question OneWire Address output / Reverse Flip address

h725

Active Member
Licensed User
Longtime User
Hello Community,

I am working with an arduino nano and the onewire library:
https://www.b4x.com/android/forum/threads/onewire-dallas-1-wire-protocol.66672/#content

The device works fine but the address I get in the log-windows is:
01 19 0E C3 11 00 00 02
But it should be:
02 00 00 11 C3 0E 19 01 (that address is on the ibutton)

I have added spaces due to better readability. They are not shown in the output.

How can I reverse the output?

Kind regards
h725
 
Last edited:

h725

Active Member
Licensed User
Longtime User
Thank you very much.
I tried the above code snippet and modified it a little bit so I could see the output:


B4X:
Dim a() As Byte = Array As Byte(0x01, 0x19, 0x0E, 0xC3, 0x11, 0x00, 0x00, 0x02)
    Log("Original: ",bc.HexFromBytes(a))
    Dim bc2 As ByteConverter
    Dim b(8) As Byte
    bc2.ArrayCopy2(a, 4, b, 0, 4)
    bc2.ArrayCopy2(a, 0, b, 4, 4)
    Log("Reverse: ",bc2.HexFromBytes(b))

The output is now:

Original: 01 19 0E C3 11 00 00 02
Reverse: 11 00 00 02 01 19 0E C3

But I need it reverse like this:
Reverse(requested): 02 00 00 11 C3 0E 19 01
 
Last edited:
Upvote 0
Top