Ejemplo n.º 1
0
        public static void Run()
        {
            using (var j = new SenseHatJoystick())
            {
                while (true)
                {
                    j.Read();

                    Console.Clear();
                    if (j.HoldingUp)
                    {
                        Console.Write("U");
                    }
                    if (j.HoldingDown)
                    {
                        Console.Write("D");
                    }
                    if (j.HoldingLeft)
                    {
                        Console.Write("L");
                    }
                    if (j.HoldingRight)
                    {
                        Console.Write("R");
                    }
                    if (j.HoldingButton)
                    {
                        Console.Write("!");
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public Joystick(int refreshRate)
 {
     _refreshRate = refreshRate;
     _joyStick    = new SenseHatJoystick();
     _isRunning   = false;
     lastState    = new JoystickState();
     Start();
 }