Closed bravecorvus closed 6 years ago
You're missing the most important thing here: the output of the log.Fatalf
call. What was the error?
That said, if I understand your description correctly then this is unlikely to be a bug in the serial package, but rather your wrapper code.
I am currently utilizing your package in an clock program that sends time over serial USB. I want to ensure that the program can "attempt" to open the device via serial USB, but ignore the case when the Arduino is not connected to my Raspberry Pi via USB.
I am declaring the
serial.OpenOptions{}
with the following code.Next, I try to use the following code to open the serial USB tty connection (but still open a temporary file if no such file is found)
However, this program will panic out whenever I try to send strings over serial USB.
On the other hand, the method I was using previously of just declaring and assigning the
Port
variable works flawlessly when the USB device is connected, but immediately fails when I try to write anything if the device is not connected.How can I write the program so that the program can continue to run even if the serial device cannot be found?