[Gambas-user] GB3 write Byte[] question

wally wally at ...2037...
Thu Jan 16 09:35:20 CET 2014


On 01/16/2014 09:30 AM, Benoît Minisini wrote:
> Le 16/01/2014 09:27, wally a écrit :
>> Hello,
>>
>> i want to send some data bytes to serialport using below code:
>>
>>     Public Sub Button2_Click()
>>
>>        Dim arr As Byte[]
>>        arr = [&Haa, &H15, &H00, &Hfe, &H0a, &H00, &H00, &H00, &Hff, &Hff,
>> &Hff, &Hff,
>>               &H00, &H00, &H0a, &H00, &H00, &H00, &H10, &H27, &H00, &H42]
>>
>>
>>        If SP1.Status = Net.Active Then
>>            SP1.Begin
>>                Write #SP1, arr As Byte[]
>>            SP1.Send
>>        Endif
>>
>> End
>>
>> Problem is that this code sends all byte but with leading 3 Bytes i do
>> not want to be sent.
>> (hex values)
>>
>> " 41 02 16 aa 15 00 fe 0a 00 00 00 ff ff ff ff 00 00 0a 00 00 00 10 27
>> 00 42 "
>>
>> I assume " 41 02 " is identifer for Byte-Array and hex 16 i(dec22) s the
>> length of array
>>
>>
>> How can i send this array without these leading 3 bytes ?
>>
>> Do i need the Begin/ Send Method for a single array to be sent ?
>>
>> thx wally
>>
> Use the Write() method of the Byte[] class.
>
> Regards,
>

:)
thanks a lot





More information about the User mailing list