[Gambas-user] Serial Port Reading and triggered upon receiving data
    Tobias Boege 
    taboege at gmail.com
       
    Sat May  5 16:46:41 CEST 2018
    
    
  
On Fri, 04 May 2018, KKing wrote:
> Any useful examples of code listening to a Serial Port and acting upon
> binary data being received as will need to interrogate bits set within
> bytes?
> 
> Can you setup a watch like event on a serial port?
> 
As usual with streams in Gambas, that event is called Read [1].
I don't have anything to connect to a serial port (if I even have
one), but it would look like this:
  ' Assuming you have a SerialPort1 object
  Public Sub SerialPort1_Read()
    Dim iByte As Byte
    iByte = Read #Last, 1
    ' Do something with your byte...
  End
Gambas has builtins for bit manipulation [2].
Regards,
Tobi
[1] http://gambaswiki.org/wiki/comp/gb.net/serialport/.read
[2] http://gambaswiki.org/wiki/cat/bit
-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
    
    
More information about the User
mailing list