private void InitiateGSR() { bool connected = false; foreach (string port in COMHandler.Ports()) { if (port != hrCollect.MyPort()) { Log.LogMessage("Trying to bind GSR to port: " + port); gsrCollect = new GSRCollector(port, fusionData); if (gsrCollect.TestPort()) { connected = true; gsrPort.Text = "(" + port + ")"; Log.LogMessageSameLine("Trying to bind GSR to port: " + port + " - SUCCES"); } else { Log.LogMessageSameLine("Trying to bind GSR to port: " + port + " - FAILED"); } } } if (!connected) { Log.LogMessage("GSR not found"); gsrReady.BackColor = Color.Red; } else { gsrReady.BackColor = Color.Green; GSRDeviceReady = true; } }
public bool Connect() { bool connected = false; foreach (var item in COMHandler.Ports()) { Log.LogMessage("Trying to bind HR to port: " + item); if (COMHandler.IsArduino(item)) { arduino = COMHandler.PortNamed(item, 115200, Parity.None, StopBits.One, 8); connected = true; Log.LogMessageSameLine("Trying to bind HR to port: " + item + " - SUCCES"); break; } else { Log.LogMessageSameLine("Trying to bind HR to port: " + item + " - FAILED"); } } return(connected); }