blob: 48b71e71792c1d5f775e5cd7f2e888d10a8ea4b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package main
import (
"log"
"xengineering.eu/iot-core/communication"
)
func main() {
ports, err := communication.GetStSerials()
if err != nil {
log.Fatal(err)
}
if len(ports) != 1 {
log.Fatalf("Require exactly one serial port from STMicroelectronics but %d attached", len(ports))
}
log.Printf("Detected serial port: %s\n", ports[0])
phy, err := communication.NewPhy(ports[0])
log.Println("Starting to print out incoming data from serial port")
err = phy.Cat()
if err != nil {
log.Fatal(err)
}
}
|