So this code gets all the serial ports, and makes them into a selectiongrid with one button for each port.
When you click one of the COM ports, it goes to the line after the snip:
string[] ports;
ports = SerialPort.GetPortNames();
selectionGridInt = GUI.SelectionGrid (new Rect (25, 25, 300, 60), selectionGridInt, ports, 1);
(snip)
SerialPort SerialStream = new SerialPort(ports[selectionGridInt], 9600, Parity.None, 8, StopBits.One);
But I get an error: Port “COM11” does not exist. (COM11 is the name of the button I click, and is the only serial port on my system.) I don’t understand: I’m getting the name of the port from the system, so why is it saying it doesn’t exist?
(I don’t know where that “5.” comes from on the last line, I didn’t write it there)