Public Class Form1

    Private Sub OpenFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenFileToolStripMenuItem.Click

    End Sub

    Private Sub ToolTip1_Popup(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PopupEventArgs)

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Enabled = False
    End Sub

    Private Sub TrackBar2_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Label2.Text = TrackBar2.Value
    End Sub

    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        Label1.Text = TrackBar1.Value
    End Sub

    Private Sub TrackBar3_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar3.Scroll
        Label3.Text = TrackBar3.Value
    End Sub

    Private Sub TrackBar4_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar4.Scroll
        Label4.Text = TrackBar4.Value
    End Sub

    Private Sub TrackBar5_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar5.Scroll
        Label6.Text = TrackBar5.Value
    End Sub

    Private Sub TrackBar2_Scroll_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar2.Scroll
        Label2.Text = TrackBar2.Value
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

    End Sub

    Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click

    End Sub

    Private Sub TrackBar6_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar6.Scroll
        Label11.Text = TrackBar6.Value
    End Sub

    Private Sub TrackBar7_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar7.Scroll
        Label12.Text = TrackBar7.Value
    End Sub

    Private Sub TrackBar8_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar8.Scroll
        Label13.Text = TrackBar8.Value
    End Sub

    Private Sub TrackBar9_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar9.Scroll
        Label14.Text = TrackBar9.Value
    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
    Dim flag As Boolean
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label18.Text = DateString
        Label19.Text = TimeString

        If flag = True Then
            Label20.BackColor = Color.Gold
            Label20.Text = "Systeme working"
            flag = False
        Else

            Label20.BackColor = Color.Red
            Label20.Text = ""
            flag = True
        End If
    End Sub

    Private Sub COMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub SetUpParametersToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetUpParametersToolStripMenuItem.Click
        SerialPort1.Close()
        SerialPort1.RtsEnable = False
        SerialPort1.PortName = ToolStripComboBox1.Text
        SerialPort1.BaudRate = ToolStripComboBox2.Text
        SerialPort1.StopBits = ToolStripComboBox3.Text
        SerialPort1.DataBits = ToolStripComboBox4.Text
        SerialPort1.Parity = IO.Ports.Parity.None 'ToolStripComboBox5.Text
        SerialPort1.Open()
        SerialPort1.RtsEnable = True
        Timer1.Enabled = True

        '  SerialPort1.Write("#")
        '  SerialPort1.Write(Label16.Text)
        '  SerialPort1.Write("#")
        '  SerialPort1.Write(Label17.Text)
        '  SerialPort1.Write("*")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SerialPort1.Write("$")
        SerialPort1.Write("N")
        SerialPort1.Write("#")
        SerialPort1.Write(Label1.Text)
        SerialPort1.Write(Label2.Text)
        SerialPort1.Write(Label3.Text)
        SerialPort1.Write(Label4.Text)
        SerialPort1.Write("#")
        SerialPort1.Write(Label6.Text)
        SerialPort1.Write("#")
        SerialPort1.Write(TextBox1.Text)
        SerialPort1.Write("#")
        SerialPort1.Write(TextBox2.Text)
        SerialPort1.Write("*")
    End Sub
End Class
