Send datas on serial port with gambas 3
Hi,
To send ASCII text on serial port of your computer, it's simple.
first, define serial port properties, open port, and send datas as this :
'port properties
If scmd.Status = Net.Inactive Then
scmd.portname = "/dev/ttyUSB0"
scmd.Speed = 4800
scmd.Parity = 0
scmd.StopBits = 1
scmd.DataBits = 8
scmd.FlowControl = 0
scmd.Open() 'open port
Endif
to send ASCII datas :
If scmd.Status = Net.active Then
Print #scmd, mytext;
End If
here mytext is a string variable
So now if you want to send another data type as byte, integer, short, long or other, you have to use WRITE command as this example bellow :
Write #scmd,myvariable as byte
Thanks for your attention.