Hi,
I'm making kind of home autmation system with a usb interface card.
8 digital & 8 analog inputs and 8 digital & 8 analog outputs.
The status of the inputs is refreshed with a timer.tick and written to variable.
Now the problem.
I want to make an digital output active when a button(real button, not a switch) is pushed and when it is pushed again the output should be set to non active.
action() is called every timer.tick
StatusDigInput1 = status of digital input =true when pushing button
StatusDigOutput1 = status used for displaying output status
SetDigitalChannel(Card1, 1) = sets digital output 1 of card1 to enabled
ClearDigitalChannel(Card1, 1) = sets digital output 1 of card1 to disabled
I've written something like this
End SubProblem is that the status of the inputs is updated so fast that i get a flashing output as long the input is active.
I'm making kind of home autmation system with a usb interface card.
8 digital & 8 analog inputs and 8 digital & 8 analog outputs.
The status of the inputs is refreshed with a timer.tick and written to variable.
Now the problem.
I want to make an digital output active when a button(real button, not a switch) is pushed and when it is pushed again the output should be set to non active.
action() is called every timer.tick
StatusDigInput1 = status of digital input =true when pushing button
StatusDigOutput1 = status used for displaying output status
SetDigitalChannel(Card1, 1) = sets digital output 1 of card1 to enabled
ClearDigitalChannel(Card1, 1) = sets digital output 1 of card1 to disabled
I've written something like this
VB.NET:
Private Sub action()
If (StatusDigInput1 = True) And (StatusDigOutput1 = False) Then
SetDigitalChannel(Card1, 1)
StatusDigOutput1 = True
End If
If (StatusDigInput1 = True) And (StatusDigOutput1 = True) = True Then
StatusDigOutput1 = False
ClearDigitalChannel(Card1, 1)
End If
End SubProblem is that the status of the inputs is updated so fast that i get a flashing output as long the input is active.