Hi
Question- I am currently writing a VB program for a traffic light control system. It nothing too robust nor with any microprocessors/sensors.
i am using a Timer to control when the lights turns Red/Amber/Green which depicts the Conventional traffic light system of Stop/Ready or Wait/Go Respectively. so far i have been able to make my Light Signals come on and off but am yet to implement my Timers.
here below is a scenario of how i would like ti see it work
If Red is Visible then countdown for about 120seconds and switch to Amber for about 10 seconds and then back to 120seconds for Green.
thank you!!
Question- I am currently writing a VB program for a traffic light control system. It nothing too robust nor with any microprocessors/sensors.
i am using a Timer to control when the lights turns Red/Amber/Green which depicts the Conventional traffic light system of Stop/Ready or Wait/Go Respectively. so far i have been able to make my Light Signals come on and off but am yet to implement my Timers.
here below is a scenario of how i would like ti see it work
If Red is Visible then countdown for about 120seconds and switch to Amber for about 10 seconds and then back to 120seconds for Green.
Code:
Public Class Form1
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
OvalShape2.Visible = False
OvalShape1.Visible = True
OvalShape3.Visible = False
If OvalShape1.Visible = True Then
TextBox1.Text = "STOP!!!"
End If
End Sub
Private Sub OvalShape1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OvalShape1.Click
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If OvalShape1.Visible Then
Timer1.Enabled = True
Timer1.Start()
Timer1.Interval = 10
ElseIf OvalShape2.Visible Then
End If
Timer1.Interval = 10
If OvalShape3.Visible Then
Timer1.Interval = 10
End If
Call Timer1.Start()
End Sub
End Class
thank you!!
Comment