Sub Timer_buffer_Tick
If connected Then
lbl_connected.Visible = True
lbl_connected.Text = "Device connected..."
lbl_connected.TextColor = Colors.Green
If text_serial_in.Ready Then 'check if there is any data waiting to be read
'buffer_in_lenght = text_serial_in.Read(buffer_in, 0, buffer_in.Length )
'text_log.Add(DateTime.Time(DateTime.Now) & " --> " & "Received: " & converter.fromchars(buffer_in))
text_log.Add(DateTime.Time(DateTime.Now) & " --> " & "Received: " & text_serial_in.ReadLine )
End If
If (seek_pwm1_old <> seek_pwm1.Value) Then
text_serial_out.Write("p1" & seek_pwm1.Value)
text_serial_out.Flush
text_log.Add(DateTime.Time(DateTime.Now) & " --> " & "Sended pwm1 value: " & seek_pwm1.Value)
seek_pwm1_old = seek_pwm1.Value
Else If (seek_pwm2_old <> seek_pwm2.Value) Then
text_serial_out.Write("p2" & seek_pwm2.Value)
text_serial_out.Flush
text_log.Add(DateTime.Time(DateTime.Now) & " --> " & "Sended pwm2 value: " & seek_pwm2.Value)
seek_pwm2_old = seek_pwm2.Value
Else If (seek_pwm3_old <> seek_pwm3.Value) Then
text_serial_out.Write("p3" & seek_pwm3.Value)
text_serial_out.Flush
text_log.Add(DateTime.Time(DateTime.Now) & " --> " & "Sended pwm3 value: " & seek_pwm3.Value)
seek_pwm3_old = seek_pwm3.Value
End If
Else
lbl_connected.Visible = Not(lbl_connected.Visible)
lbl_connected.Text = "No device connected..."
lbl_connected.TextColor = Colors.Red
End If
End Sub