0

I am using Gobot with 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?

Other programs from the examples in Arduino IDE work as expected. What am I doing wrong?

Prasad Surase
  • 6,486
  • 6
  • 39
  • 58
  • "You must install Firmata on your microcontroller before you can connect to it using Gobot. You can do this in many cases using Gort (http://gort.io)", have you done that? – Marcos G. Jul 03 '19 at 18:08
  • @MarcosG. I did install firmata on the microcontroller using gort. – Prasad Surase Jul 04 '19 at 04:26
  • It looks like your board is not compatible with the firmware. See [here](https://discourse.vvvv.org/t/arduino-uno-firmata/7521/14) – Marcos G. Jul 04 '19 at 04:45
  • @MarcosG. I tried the RGB example using the Arduino IDE and it works as expected. I selected the ESP8266 as the board and /dev/cu.*.1410 as the port to upload the program. – Prasad Surase Jul 04 '19 at 05:41
  • But that only means your board is connecting and working with Arduino sketches. Maybe you don't have the right firmware for your board. The error you see means the connecting timed out and if your board is working with Arduino sketches it can only be firmware related or some kind of version mismatch. There seem to be too many ways to do that. Have you tried [alternative ways](https://gobot.io/documentation/platforms/esp8266/) to install the firmware? – Marcos G. Jul 04 '19 at 07:00

0 Answers0