INNER CODE UNIT · Go
main
arduino/arduino-cli · commands/term_example/main.go:33
func main() {
conn, err := grpc.NewClient("localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatal("error connecting to arduino-cli rpc server, you can start it by running `arduino-cli daemon`")
}
defer conn.Close()
// Create and initialize a CLI instance
cli := commands.NewArduinoCoreServiceClient(conn)
resp, err := cli.Create(context.Background(), &commands.CreateRequest{})
if err != nil {
log.Fatal("Create:", err)
}
instance := resp.GetInstance()
respStream, err := cli.Init(context.Background(), &commands.InitRequest{Instance: instance})
if err != nil {