コード例 #1
0
        private void ThreadWatch()
        {
            CurrentState = new GPIOState();
            while (true)
            {
                var sw1 = GPIO24_Sw1.Value != 0;

                lock (CurrentState)
                {
                    if (CurrentState.sw1 != sw1)
                    {
                        CurrentState.sw1  = sw1;
                        CurrentState.led1 = GPIO25_LED1.Value != 0;

                        if (CurrentState.sw1 == true)
                        {
                            GPIO.Instance.UpdateButtonStatus("Button Pressed!!");
                            Console.WriteLine("Button Pressed");
                        }
                        else
                        {
                            GPIO.Instance.UpdateButtonStatus("Button Not Pressed!!");
                            Console.WriteLine("Button Not Pressed!");
                        }
                    }
                }


                Thread.Sleep(10);
            }
        }
コード例 #2
0
ファイル: Global.asax.cs プロジェクト: LuckyOpenU/NFCproject
        private void ThreadWatch()
        {
            CurrentState = new GPIOState();
            while (true)
            {

                var sw1 = GPIO24_Sw1.Value != 0;

                lock (CurrentState)
                {
                    if (CurrentState.sw1 != sw1)
                    {
                        CurrentState.sw1 = sw1;
                        CurrentState.led1 = GPIO25_LED1.Value != 0;

                        if (CurrentState.sw1 == true)
                        {
                            GPIO.Instance.UpdateButtonStatus("Button Pressed!!");
                            Console.WriteLine("Button Pressed");
                        }
                        else
                        {
                            GPIO.Instance.UpdateButtonStatus("Button Not Pressed!!");
                            Console.WriteLine("Button Not Pressed!");
                        }
                    }
                }

                Thread.Sleep(10);
            }
        }
コード例 #3
0
        private void ThreadButton()
        {
            CurrentState = new GPIOState();

            while (true)
            {
                var sw1 = GPIO17_Sw1.Value != 0;

                lock (CurrentState)
                {
                    if (CurrentState.sw1 != sw1)
                    {
                        CurrentState.sw1 = sw1;
                        CurrentState.led1 = GPIO27_LED1.Value != 0;

                        if (CurrentState.sw1 == true)
                        {
                            MvcApplication2.SignalR.GPIO.Instance.UpdateButtonStatus("Button Pressed!!");
                            Console.WriteLine("Button Pressed");
                        }
                        else
                        {
                            MvcApplication2.SignalR.GPIO.Instance.UpdateButtonStatus("Button Not Pressed!!");
                            Console.WriteLine("Button Not Pressed!");
                        }
                    }
                }
                Thread.Sleep(100);
            }
        }