Best Answer liqdfire, 20 March 2014 - 02:56 AM
See if this is any better, I already put my logic analyzer away.
Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoPlus Module Module1 Dim led1 As New OutputPort(Pins.GPIO_PIN_D0, False) Dim led2 As New OutputPort(Pins.GPIO_PIN_D1, False) Dim led3 As New OutputPort(Pins.GPIO_PIN_D2, False) Dim led4 As New OutputPort(Pins.GPIO_PIN_D3, False) Private _thread1Wait As AutoResetEvent Private _thread2Wait As AutoResetEvent Private _thread3Wait As AutoResetEvent Private _threadX As Thread Private _threadY As Thread Private _threadZ As Thread Sub Main() _thread1Wait = New AutoResetEvent(False) _thread2Wait = New AutoResetEvent(False) _thread3Wait = New AutoResetEvent(False) _threadX = New Thread(AddressOf led1t) _threadY = New Thread(AddressOf led2t) _threadZ = New Thread(AddressOf led3t) _threadX.Start() _threadY.Start() _threadZ.Start() _thread1Wait.Set() _thread2Wait.Set() _thread3Wait.Set() System.Threading.WaitHandle.WaitAll(New System.Threading.AutoResetEvent() {_thread1Wait, _thread2Wait, _thread3Wait}) led4.Write(True) Thread.Sleep(Timeout.Infinite) ' Call this here or your program will exit.. End Sub Sub led1t() _thread1Wait.WaitOne() Dim x As Integer = 0 While x < 30 x += 1 led1.Write(True) Thread.Sleep(25) led1.Write(False) Thread.Sleep(25) Debug.Print("Led1 Blink Count = " & x.ToString) End While _thread1Wait.Set() _threadZ.Join() End Sub Sub led2t() _thread2Wait.WaitOne() Dim y As Integer = 0 While y < 15 y += 1 led2.Write(True) Thread.Sleep(25) led2.Write(False) Thread.Sleep(25) Debug.Print("Led2 Blink Count = " & y.ToString) End While _thread2Wait.Set() _threadZ.Join() End Sub Sub led3t() _thread3Wait.WaitOne() Dim z As Integer = 0 While z < 55 z += 1 led3.Write(True) Thread.Sleep(25) led3.Write(False) Thread.Sleep(25) Debug.Print("Led3 Blink Count = " & z.ToString) End While _thread3Wait.Set() End Sub End ModuleGo to the full post