public void Start() { Console.WriteLine(Environment.OSVersion.Platform); ShimmerController sc = new ShimmerController(this); sc.Connect(comPort); Console.WriteLine("Connecting..."); do // TODO : fix this, can cause hang if cannot connect to Shimmer { System.Threading.Thread.Sleep(100); } while (!sc.ShimmerDevice.IsConnected()); Console.WriteLine("Connected"); Console.WriteLine("Starting stream..."); sc.ShimmerDevice.Set3DOrientation(true); // set 3D orientation sc.ShimmerDevice.WriteBaudRate(230400); // set baud rates Console.WriteLine("Baud Rate: " + sc.ShimmerDevice.GetBaudRate()); Console.WriteLine("Sampling Rate: " + sc.ShimmerDevice.GetSamplingRate()); sc.StartStream(); Console.ReadKey(); Console.WriteLine("Stopping stream..."); sc.StopStream(); Console.ReadKey(); }
// connect to a shimmer, comPort must be set public void Connect() { Debug.Log("CONNECT AND STREAM CLICKED"); this.comPort = inputComPort.text; Debug.Log("USING COM" + this.comPort); txtOutput.text = "Connecting..."; sc = new ShimmerController(this); txtOutput.text += "\nTrying to connect on COM" + this.comPort; sc.Connect("COM" + this.comPort); }
// connect to a shimmer, comPort must be set public void Connect() { selectedItem = deviceDropdown.SelectedDevice; if (selectedItem == null) { Debug.Log("NO DEVICE SELECTED!"); return; } Debug.Log("CONNECT AND STREAM CLICKED"); this.comPort = selectedItem.ComPort.ToString(); Debug.Log("USING COM" + this.comPort); txtOutput.text = "Connecting..."; sc = new ShimmerController(this); txtOutput.text += "\nTrying to connect on COM" + this.comPort; sc.Connect("COM" + this.comPort); IsConnecting = true; }