static void Main(string[] args) { Console.WriteLine("Started..."); Thread IO = new Thread(IOThread); Thread processIO = new Thread(processIOThread); if (!ArduinoCom.IsOpen) { Console.WriteLine("Available Ports:"); foreach (string s in SerialPort.GetPortNames()) { Console.WriteLine(" {0}", s); } Console.Write("Which COM Port? "); string port = Console.ReadLine().ToUpper(); ArduinoCom.PortName = port; ArduinoCom.Open(); //processIO.Start(); IO.Start(); } else { Console.WriteLine("An error occurred"); Console.ReadKey(); Environment.Exit(0); } while (true) { Query(Console.ReadLine().ToUpper()); } }
private void btnOpen_Click(object sender, EventArgs e) { if (cmbComs.Text != "") { ArduinoCom.PortName = cmbComs.Text; ArduinoCom.Open(); btnOpen.Enabled = false; btnClose.Enabled = true; btnWrite.Enabled = true; btnRead.Enabled = true; } }