You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
However, this program will panic out whenever I try to send strings over serial USB.
b := []byte("TRIAL STRING")
_, err := Port.Write(b)
if err != nil {
log.Fatalf("Port.Write: %v", err)
}
/home/pi/go/src/github.com/gilgameshskytrooper/prometheus/prometheus.go:231 +0x110
github.com/robfig/cron.FuncJob.Run(0x10717cb0)
/home/pi/go/src/github.com/robfig/cron/cron.go:92 +0x1c
github.com/robfig/cron.(*Cron).runWithRecovery(0x107189f0, 0x3ec300, 0x10717cb0)
/home/pi/go/src/github.com/robfig/cron/cron.go:165 +0x54
created by github.com/robfig/cron.(*Cron).run
/home/pi/go/src/github.com/robfig/cron/cron.go:199 +0x554
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.
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?
The text was updated successfully, but these errors were encountered: