[Gambas-user] Read a Serial data ttySx

Dimitri Bellini dimitribellini at ...69...
Mon May 12 17:41:30 CEST 2003


Hi List
	i have to read a serial data from a ttySx and i use stty command to set the 
9600bps 8N1 no hardware control on Serial Port but nothing to do i write this 
very simple Project but nothing... There is a End Of Line Type?
Thanks in advace.

----------------------------------------------------------------------------
STATIC PUBLIC SUB Main()
  hForm AS Fmain
  hForm = NEW Fmain
  hForm.show
END

PUBLIC SUB Button1_Click()
  myLine AS String
  myFile AS File

  OPEN "/dev/ttyS0" FOR READ AS myFile
  WHILE NOT Eof (myFile)

 'Eof = end of file 
   LINE INPUT #myFile, myLine

 '# is a kind of pointer 'which is incremented by LINE INPUT 
  TextArea1.Text= TextArea1.Text & "<br>" & myLine
  WEND
  CLOSE myFile

 'do not forget to close the door ;-) 
END
-------------------------------------------------------------------------------------

Dimitri

Ps. Sorry ... I'am not a very expert. :-)




More information about the User mailing list