Я использую Gobot с Arduino Uno D1 Wemos ESP8266.
$ gort scan serial
/dev/cu.Bluetooth-Incoming-Port /dev/cu.usbserial-1410
/dev/tty.Bluetooth-Incoming-Port /dev/tty.usbserial-1410
$ cat blink.go
package main
import (
"time"
"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/firmata"
)
func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/tty.usbserial-1410")
led := gpio.NewLedDriver(firmataAdaptor, "13")
work := func() {
gobot.Every(1*time.Second, func() {
led.On()
time.Sleep(1 * time.Second)
led.Off()
})
}
robot := gobot.NewRobot("bot",
[]gobot.Connection{firmataAdaptor},
[]gobot.Device{led},
work,
)
robot.Start()
}
➜ go run blink.go
# command-line-arguments
ld: warning: building for macOS, but linking in object file
(/var/folders/qz/v87zx1dd6cb_27lkx7yxqqt40000gp/T/go-link-728857552/go.o) built for
2019/07/03 23:10:29 Initializing connections...
2019/07/03 23:10:29 Initializing connection Firmata-77170CB7B110D741 ...
2019/07/03 23:10:29 Initializing devices...
2019/07/03 23:10:29 Initializing device LED-4ABBCD5F1E6D2FE3 ...
2019/07/03 23:10:29 Robot bot initialized.
2019/07/03 23:10:29 Starting Robot bot ...
2019/07/03 23:10:29 Starting connections...
2019/07/03 23:10:29 Starting connection Firmata-77170CB7B110D741 on port /dev/tty.usbserial-1410...
2019/07/03 23:10:44 1 error occurred:
* unable to connect. Perhaps you need to flash your Arduino with Firmata?
Другие программы из примеров в Arduino IDE работают должным образом.Что я делаю не так?