Hi
I have an interrupt problem. When i use the onboard sw then is everything OK. But when i change (pins.ONBOARD_SW1 to pins.GPIO_PIN_D0) and i run it then the boolean bRedyToStart is not stable. The boolean changed from state af few times. I use my own button.
I connect the button with one side to the D0 pin and the other side of the button i connect with GND.
Code:
Dim swStartStop As New InterruptPort(Pins.ONBOARD_SW1, True, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow)
AddHandler swStartStop.OnInterrupt, AddressOf StartMachine
Private Sub StartMachine(ByVal data1 As UInteger, ByVal data2 As UInteger, ByVal time As Date)
If bRedyToStart = False Then
bRedyToStart = True
buffer = encoding.GetBytes("H")
rs232.Write(buffer, 0, buffer.Length)
Thread.Sleep(1000)
Else
bRedyToStart = False
buffer = encoding.GetBytes("L")
rs232.Write(buffer, 0, buffer.Length)
Thread.Sleep(1000)
End If
End Sub
Thanks for help