If usb1.UsbPresent(1) = usb1.USB_NONE Then ' Ver_2.4
Msgbox("No USB device or accessory detected!", "Error")
Return
End If
Log("Checking permission 1")
If (usb1.HasPermission(1)) Then ' Ver_2.4
Msgbox(usb1.DeviceInfo(1),"Info")
'This is very important - ( VendorId, ProductId )
usb1.SetCustomDevice(usb1.DRIVER_SILABS, 0x1504, 0x6)
Dim dev As Int
dev = usb1.Open(19200, 1) '
If dev <> usb1.USB_NONE Then
Msgbox("Connected successfully! 1","Info")
astreams1.Initialize(usb1.GetInputStream, usb1.GetOutputStream, "astreams1")
'This is important
usb1.SetParameters(19200, usb1.DATABITS_8,usb1.STOPBITS_1, usb1.PARITY_NONE)
'Here if you want codce that call print
astreams1.Write("abcde".GetBytes("UTF8"))
astreams1.Close
usb1.Close
Else
Log("Error opening USB port 1")
End If
Else
usb1.RequestPermission(1) ' Ver_2.4
End If