How would I create an array of bytes form string inputs. I posted this this before but just for 1 short. Now I need to make an array. Example the PIC mcu is looking for 4 words/shorts to to be sent to it.
This is wrong as it wont compile
Thank you
This is wrong as it wont compile
B4X:
Dim BC As ByteConverter
Dim dm As Short = "1" 'convert the string to short
Dim Cspd As Short = txtCycleSpeed.Text 'convert the string to short
Dim Rspd As Short = txtRelaySpeed.Text 'convert the string to short
Dim Ccnt As Short = txtCycleCnt.Text 'convert the string to short
Dim PicWrd(3) As Byte
PicWrd(0) = BC.ShortsToBytes(Array As Short(dm))
PicWrd(1) = BC.ShortsToBytes(Array As Short(Cspd))
PicWrd(2) = BC.ShortsToBytes(Array As Short(Rspd))
PicWrd(3) = BC.ShortsToBytes(Array As Short(Ccnt))
AStream.Write(PicWrd)
Thank you