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(); }
// attempt to start streaming public void StartStream() { if (!IsPaired) { Debug.Log("NOT PAIRED!"); return; } if (IsStreaming) { Debug.Log("ALREADY STREAMING"); } IsStreaming = true; Debug.Log("PAIRED!"); sc.ShimmerDevice.WriteBaudRate(230000); txtOutput.text += "\nConnected"; // set options, start streaming sc.ShimmerDevice.Set3DOrientation(true); txtOutput.text += "\nStarting stream..."; sc.StartStream(); isStreamingBackground.color = Color.green; txtIsStreaming.text = "Streaming"; }
// attempt to start streaming public void StartStreaming() { if (!IsPaired) { Debug.Log("NOT PAIRED!"); return; } Debug.Log("PAIRED!"); sc.ShimmerDevice.WriteBaudRate(230000); txtOutput.text += "\nConnected"; // set options, start streaming sc.ShimmerDevice.Set3DOrientation(true); txtOutput.text += "\nStarting stream..."; sc.StartStream(); }