I'm using the serial library to send out a 128 element char array. I send out the bytes one at a time, and then print the index. There is no response expected from the piece of hardware I'm communicating with while the packet is being sent. This works great on my XP computer, but on Vista, it hangs during the write() function randomly. The piece of code that it hangs on is copied below, and I'm getting really confused. Processing just stops in the middle of the for loop. It always hangs at
different times (it'll get through this piece of code a few times before failing, and never fails at the same index). I'd really appreciate any ideas. Thanks.
for (int i = 0; i<128; i++){ myPort.write(pageSend[i]); println(i); }
I'm using the Serial library, and I was wondering if there is a way to automatically select the serial port. The examples I've seen always assume you know which port you want, and that you will select the appropriate one in the Serial.list() array. My problem is that I am trying to export my sketch as an application, and I do not know which port is going to be the right one on any given computer. My first attempt was to open each port and send out a query, and then listen for a defined response from my device, and then select that com port. That worked well enough, until I ran into the problem that some of the other com ports were in use, and processing threw and error and quit. Is there a way to tell if a com port is in use before trying to use it? Or is there a better method to achieve what I am trying to do?