Android Question Serial BT connection problem...

Discussion in 'Android Questions' started by Spectre, Apr 2, 2015.

  1. Spectre

    Spectre Active Member Licensed User

    Hi!
    I have this problem with the serial connection BT . The system connects But when I try to read the serial dates From BT freezes code ...



    Code:
    Sub Timer_buffer_Tick   
    'when the connection is established check the serial Arduino to receive the time from sensors

        
    If connected Then      

                    
    '******************EXTRACT STRAT E STOP TIME********
                    Dim StartTime As Float
                    
    Dim StopTime As Float              
                    
    Dim RX_string As String
                   
                    RX_string=text_serial_in.ReadLine    & 
    CRLF
                    lbl_sens1.Text=sf.MidExtract(RX_string,
    "(",")")
                    lbl_sens2.Text=sf.MidExtract(RX_string,
    "[","]")
                    StartTime=sf.MidExtract(RX_string,
    "(",")")                   
                    StopTime=sf.MidExtract(RX_string,
    "[","]")           
                    
    '***************************************************
                    StringRead=Calc_speed(StopTime-StartTime)
                    Calcoli(StringRead)                   
                    
    ToastMessageShow("**** PRONTO/READY ****",False)
                
    Catch
                    
    Msgbox("Colpo non rivelato/ Bad Shot","Avviso/Alert")
                    
    Return           
                
    End Try
               
            
    If  IsNumber(StringRead)=False Then
                    
    Return
                
    End If           
            
    End If
        
    End If
        
    If chk_showstat.Checked=True Then
            
    If ShotCount > =  spi_NShot.SelectedItem + 1 Then   
                
    If Timerit > 4 Then
    '            per uso futuro
           
                
    End If
            
    End If
        
    End If
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The only proper way to read data from a Bluetooth device (or socket) is with AsyncStreams.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice