Hallo zusammen.
Ich weiss, ich weiss nicht viel. Aber was ich weiss ist, dass dies hier nicht funktioniert.
Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress _
As Integer) As Integer
Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress _
As Integer, ByVal Value As Integer)
Dim impz As Int32 'Impulszähler
Dim spannung As Int32 = 1
Private Sub Timer1_Sensor_Tick(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Timer1.Tick
'Dim test As Int32 = Inp(889) And 8 'Pin 15-Test ( _
jeweils 1 durch 8 ers.)
Dim test As Int32 = Inp(888) And 1 'D0 Test
If spannung = 1 And test = 0 Then
impz += 1 'Zähler erhöhen
Label1_meter.Text = impz / 100 _
'Wert anzeigen
spannung = 0
End If
If spannung = 0 And test = 1 Then spannung = 1
End Sub
Private Sub Timer1_2_Tick(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Timer1.Tick
Dim test2 As Int32 = Inp(889) And 8 'Pin 15-Test
If test2 = 8 Then
Out(888, Inp(888) And 250) 'Led D0 ist Aus
Button1.BackColor = Color.WhiteSmoke
Else
Out(888, Inp(888) Or 1) 'Led D0 ist An
Button1.BackColor = Color.Red
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Timer2.Tick
Dim test_sensor As Int32 = Inp(889) And 16
If test_sensor <> 16 And automation = 0 Then
Out(888, Inp(888) Or 128) 'Led D7 ist An
Button8.BackColor = Color.Red
Else
Out(888, Inp(888) And 126)
Button8.BackColor = Color.WhiteSmoke
End If
End Sub
Private Sub Timer2_1_Tick(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Timer2.Tick
Dim test_sensor As Int32 = Inp(889) And 16
If test_sensor <> 16 And automation = 1 Then
Out(888, Inp(888) Or 128) 'Led D7 ist An
Button8.BackColor = Color.Yellow
Else
Out(888, Inp(888) And 126)
Button8.BackColor = Color.WhiteSmoke
End If
End Sub
Private Sub Timer2_2_Tick(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Timer2.Tick
Dim test_sensor As Int32 = Inp(889) And 16
If test_sensor <> 16 And automation = 2 Then
Out(888, Inp(888) Or 128) 'Led D7 ist An
Button8.BackColor = Color.Blue
Else
Out(888, Inp(888) And 126)
Button8.BackColor = Color.WhiteSmoke
End If
End Sub Einfach gesagt:
Bei Automation = 0 muss der button rot aufleuchten
Bei Automation = 1 Muss der Button gelb auflauchten
Bei Automation =2 Muss der Button blau aufleuchten
Jeweils nur dann wenn:
Dim test_sensor As Int32 = Inp(889) And 16
If test_sensor <> 16 And automation = 2 Then Das geht sicher anders und einfacher.
Wer kann mir helfen?
Danke  |