Hello,
I am truing to control teh pilot light using a timer in code, not with a plc. So In my screen I have a momentary button, teh pilot light, and a timer. Timer is set to tick every second. I use the momentary button to start the timer
Here Is what I have:
Private Sub MomentaryButton1_Click(sender As Object, e As EventArgs) Handles MomentaryButton1.Click
Timer1.Start()
End Sub
Dim toggle As Boolean = False
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If toggle = False Then
PilotLight1.LightColor = AdvancedHMI.Controls.PilotLight.LightColors.Green
toggle = True
If toggle = True Then
PilotLight1.LightColor = AdvancedHMI.Controls.PilotLight.LightColors.White
toggle = False
End If
End If
End Sub
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Code builds fine, but when I run it, and click the momentary button the pilot light stays in its default green state.
Where did I go wrong?
JIm