Skip to content

Commit 5ab4cf5

Browse files
committed
fix serial monitor program
1 parent 6bf07ea commit 5ab4cf5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

serial_monitor/monitor.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ var config = struct {
1818
}{
1919
// the port will be COMx on windows (where x is a number).
2020
// on linux the port will take the form /dev/ttyACM0 or /dev/ttyUSB0 (or similar)
21-
Port: "COM3",
21+
Port: "/dev/ttyACM0",
2222
Filename: "outduino.txt",
2323
}
2424

2525
func main() {
26+
if len(os.Args) > 1 {
27+
config.Port = os.Args[1]
28+
}
2629
c := &serial.Config{Name: config.Port, Baud: 9600}
2730
s, err := serial.OpenPort(c)
2831

@@ -45,7 +48,6 @@ func main() {
4548
if _, err := fo.Write(buf[:n]); err != nil {
4649
panic(err)
4750
}
48-
fmt.Printf("%q", buf[:n])
51+
fmt.Printf("%s", buf[:n])
4952
}
50-
5153
}

0 commit comments

Comments
 (0)