コード例 #1
0
ファイル: DiaLogin.cs プロジェクト: Kabouterhuisje/MiniForms
        public Task <bool> LoginWithSerialPort()
        {
            return(Task.Run(() =>
            {
                try
                {
                    var arduino = new ArduinoReader(_comPort, _baudRate);

                    var lines = arduino.ReadLines(2).ToList();
                    if (_AuthericationService.IsValid(lines[0], lines[1]))
                    {
                        return true;
                    }

                    arduino.Write("Denied");

                    return false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return false;
                }
            }));
        }
コード例 #2
0
        static void Main(string[] args)
        {
            ArduinoReader ar = new ArduinoReader();

            for (;;)
            {
                System.Threading.Thread.Sleep(5000);
            }
        }
コード例 #3
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(this);
         return;
     }
 }