Пример #1
0
    public static void Main()
    {
        using (Leap.IController controller = new Leap.Controller())
        {
            controller.SetPolicy(Leap.Controller.PolicyFlag.POLICY_ALLOW_PAUSE_RESUME);

            // Set up our listener:
            SampleListener listener = new SampleListener();
            controller.Connect       += listener.OnServiceConnect;
            controller.Disconnect    += listener.OnServiceDisconnect;
            controller.FrameReady    += listener.OnFrame;
            controller.Device        += listener.OnConnect;
            controller.DeviceLost    += listener.OnDisconnect;
            controller.DeviceFailure += listener.OnDeviceFailure;
            controller.LogMessage    += listener.OnLogMessage;

            ArduinoControllerMain controller = new ArduinoControllerMain();
            controller.SetComPort();
            for (int i = 0; i < 50; i++)
            {
                Console.WriteLine(SampleListener.data);
                controller.SendArduino(16, 129, 6, 140, 4, 30);
                controller.SendArduino(16, 127, 13, 255, 4, 30);
                controller.SendArduino(16, 127, 13, 0, 4, 30);
            }
            controller.ClosePort();

            // Keep this process running until Enter is pressed
            Console.WriteLine("Press any key to quit...");
            Console.ReadLine();
        }
    }
Пример #2
0
    public static void Main()
    {
        using (Leap.IController controller = new Leap.Controller())
        {
            controller.SetPolicy(Leap.Controller.PolicyFlag.POLICY_ALLOW_PAUSE_RESUME);

            // Set up our listener:
            SampleListener listener = new SampleListener();
            controller.Connect       += listener.OnServiceConnect;
            controller.Disconnect    += listener.OnServiceDisconnect;
            controller.FrameReady    += listener.OnFrame;
            controller.Device        += listener.OnConnect;
            controller.DeviceLost    += listener.OnDisconnect;
            controller.DeviceFailure += listener.OnDeviceFailure;
            controller.LogMessage    += listener.OnLogMessage;

            ArduinoControllerMain ArduinoController = new ArduinoControllerMain();
            ArduinoController.SetComPort();
            while (true)
            {
                // Console.WriteLine(listener.GetHandData());
                // ArduinoController.SendArduino(16, 129, 6, Convert.ToByte(listener.GetHandData().GetX()), 4, 30);
                // ArduinoController.SendArduino(16, 127, 13, 255, 4, 30);
                // ArduinoController.SendArduino(16, 127, 13, 0, 4, 30);
                byte[] toArduino = listener.GetHandData().GetDataBytes();
                ArduinoController.SendArduino(toArduino[0], toArduino[1], toArduino[2], toArduino[3], toArduino[4], toArduino[5], 50);
            }
            ArduinoController.ClosePort();

            // Keep this process running until Enter is pressed
            Console.WriteLine("Press any key to quit...");
            Console.ReadLine();
        }
    }
Пример #3
0
    public static void Main()
    {
        ArduinoControllerMain controller = new ArduinoControllerMain();

        controller.SetComPort();
        for (int i = 0; i < 50; i++)
        {
            controller.SendArduino(16, 129, 6, 0, 4, 30);
            controller.SendArduino(16, 127, 13, 255, 4, 30);
            controller.SendArduino(16, 127, 13, 0, 4, 30);
        }
        controller.ClosePort();
    }
Пример #4
0
 public static void Main()
 {
     ArduinoControllerMain a= new ArduinoControllerMain();
     a.SetComPort();
     if (a.portFound)
     {
         runProgram(a.arduinoPort);
     }
     else
     {
         Console.Write("failed to detect arduino");
     }
     System.Threading.Thread.Sleep(10000);
 }