Gobot无法为Arduino Uno D1 Wemos ESP8266运行

时间:2019-07-03 17:50:09

标签: arduino-esp8266 gobot.io

我正在将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示例中的其他程序可以正常工作。我在做什么错了?

0 个答案:

没有答案