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(); } }
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(); } }
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(); }