hi :} , i have only just taught myself some vb2008 having bought a k8055 interface board some time ago, not realizing that you needed to be able to write your own code
i am trying to make the digital output ( say channel 16 ) of my k8055 board turn on at 21:00hrs and off at 09:00hrs,
i bet i don’t need half the code that i have written and im missing something…but what
i have tried
'label8 is time
'checkbox4 is to activate the cct
'textbox3 is time on
'textbox4 is time off
'timer5 is to check time
'timer6 is turn output on
'timer7 is turn output off
Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
If CheckBox4.CheckState = 1 Then
Timer5.Enabled = True
End If
If CheckBox4.CheckState = 0 Then
ClearDigitalChannel(16) 'why dont this clear output7
ClearDigitalChannel(32)
ClearAllDigital()
Timer5.Enabled = False
End If
End Sub
'timer for light on
Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
' lights on 21:00
If Label8.Text >= TextBox3.Text And Label8.Text <= TextBox4.Text Then
Timer6.Enabled = True
Timer7.Enabled = False
End If
' lights off 09:00
If Label8.Text >= TextBox3.Text And Label8.Text >= TextBox4.Text Then
Timer6.Enabled = False
Timer7.Enabled = True
End If
End Sub
Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
If Timer6.Enabled = True Then
WriteAllDigital(16)
PictureBox1.Visible = True
PictureBox2.Visible = False
End If
If Timer6.Enabled = False Then
ClearAllDigital()
PictureBox1.Visible = False
PictureBox2.Visible = True
End If
End Sub
Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer7.Tick
If Timer7.Enabled = True Then
ClearAllDigital()
PictureBox1.Visible = False
PictureBox2.Visible = True
End If
If Timer7.Enabled = False Then
WriteAllDigital(16)
PictureBox1.Visible = True
PictureBox2.Visible = False
End If
End Sub
but there is a problem …can u help ???
if the “off” time(0900) is less than the “on” time(2100) it will not run, it is ok if it’s on is at 0900 and off at 2100.
i could reverse the values but i want to be able to change times by textbox1 and 2 values…
pleeeeease help :}