I have a serial port that is streaming data. The data is terminated by a /r only.
I am trying to use scanner.Scan () to break up the lines. Is there a way to change the scanner end of line character to /r only?
config := &serial.Config {
Name: lmt.ComPort,
Baud: 57600,
ReadTimeout: 30 * time.Second,
Size: 8,
}
stream, err = serial.OpenPort(config)
if err != nil {
fmt.Printf("ERROR - Can not open com port:%s\n", lmt.ComPort)
return
}
scanner := bufio.NewScanner(stream)
for scanner.Scan() {
bufStr := scanner.Text()
.
.
.
}
--