
Public Class Form2

    Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click

    End Sub

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = TimeOfDay.Hour
        TextBox2.Text = TimeOfDay.Minute
        TextBox3.Text = TimeOfDay.Second
        SerialPort1.Encoding = System.Text.Encoding.Default
        ' If SerialPort1.IsOpen = False Then
        'SerialPort1.BaudRate = 9600

        ' SerialPort1.Open()


        'End If




    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If TimeOfDay.Hour.ToString = TextBox1.Text And TimeOfDay.Minute.ToString = TextBox2.Text And TimeOfDay.Second.ToString = TextBox3.Text Then

            Form1.PictureBox2.Image = My.Resources._on

           



            ' If SerialPort1.IsOpen = False Then
            'SerialPort1.BaudRate = 9600

            ' SerialPort1.Open()


            'End If


            If RadioButton4.Checked = True Then
                Form1.SerialPort1.Write(1)
                Form1.Label3.Text = "Color : Red"



            End If

            If RadioButton3.Checked = True Then
                Form1.SerialPort1.Write(2)

                Form1.Label3.Text = "Color : Green"
            End If

            If RadioButton1.Checked = True Then
                Form1.SerialPort1.Write(3)
                Form1.Label3.Text = "Color : Blue"

            End If

            If RadioButton2.Checked = True Then
                Form1.SerialPort1.Write(4)
                Form1.Label3.Text = "Color : White"

            End If



        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'SerialPort1.Close()

        Me.Hide()
        'Form1.SerialPort1.Open()
        Form1.Show()

    End Sub

    Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged

    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Label5.Text = TimeOfDay.Hour & " : " & TimeOfDay.Minute & " : " & TimeOfDay.Second

    End Sub

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

    End Sub
End Class