B4R Question Load variable into an array

Mostez

Well-Known Member
Licensed User
Longtime User
hello,
is it possible to load variable or values to an array in one line of code instead of using:


B4X:
Private Buffer(8) As Byte 
.....
......

    Buffer(0) = 0x5A
    Buffer(1) =0xA5
    Buffer(2) = 0x05
    Buffer(3) =0x82
    Buffer(4) =0x00
    Buffer(5) = 0x41
    Buffer(6) =0x00
    Buffer(7) = 0x01
    Serial1.Stream.WriteBytes (Buffer,0,8)

and how can I send it to stream with variable length(must be declared with length!), i.e. one time holds 3 bytes and next time holds 4 bytes, as WriteBytes method must include number of bytes!


Thanks
 
Top