hybridgroup / gobot

Golang framework for robotics, drones, and the Internet of Things (IoT)
https://gobot.io
Other
8.95k stars 1.04k forks source link

Platform request: ESP32 #717

Open theoretick opened 4 years ago

theoretick commented 4 years ago

I'd love to see support for ESP32 at some point. Based on https://github.com/hybridgroup/gobot/issues/301 it sounds like it might be straightforward once the upstream support for ESP32 is handled within firmata https://github.com/firmata/arduino/issues/315, but figured I'd open this issue to track this request and see if I'm missing anything else.

Thank you for gobot ❤️

deadprogram commented 4 years ago

Hi @theoretick I think your assessment sound correct regarding Firmata on the ESP32.

Probably everything that applies to using the ESP8266 would be the same for the ESP32 if using WiFiFirmata.

Please let us all know if you get to try this out, and how it goes.

nilsmagnus commented 3 years ago

@theoretick have you had a chance to try this out yet?

theoretick commented 3 years ago

@theoretick have you had a chance to try this out yet?

@nilsmagnus no, I haven't. I was simply waiting on https://github.com/firmata/arduino/issues/315 to close, but it does look like there's a test branch available from soundanalogous if you're interested in trying that out. I haven't really dug into setting anything up

gen2thomas commented 1 year ago

Hi @theoretick , @nilsmagnus and @deadprogram the issue is now closed with the comment "ESP32 is supported for ConfigurableFirmata." Should we close our issue now or is there anything to do in gobot?

Thanks Thomas

tlindsay commented 1 year ago

@gen2thomas According to this comment, ESP32 is already supported? Not sure if it's accurate or not.

gen2thomas commented 1 year ago

Hi @tlindsay , it seems nobody has tested this yet. Could you do this? I'm not experienced with firmata.

tlindsay commented 11 months ago

@gen2thomas Finally got around to trying this out. Full disclosure, this is my first time working with ESP32 and with Gobot...

So far, things don't work out of the box for a esp32:esp32:adafruit_feather_esp32_v2 board.

package main

import (
    "time"

    "gobot.io/x/gobot/v2"
    "gobot.io/x/gobot/v2/drivers/gpio"
    "gobot.io/x/gobot/v2/platforms/firmata"
)

func main() {
    firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
    led := gpio.NewLedDriver(firmataAdaptor, "13")

    work := func() {
        gobot.Every(1*time.Second, func() {
            led.Toggle()
        })
    }

    robot := gobot.NewRobot("bot",
        []gobot.Connection{firmataAdaptor},
        []gobot.Device{led},
        work,
    )

    robot.Start()
}
$ go run main.go
# github.com/warthog618/gpiod
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/options.go:93:50: undefined: uapi.OutputValues
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/options.go:101:34: undefined: uapi.LineConfigAttribute
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/gpiod.go:326:35: undefined: uapi.LineInfo
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/gpiod.go:351:37: undefined: uapi.LineInfoV2
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/gpiod.go:391:26: undefined: uapi.LineInfo
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/gpiod.go:401:28: undefined: uapi.LineInfoV2
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/gpiod.go:596:43: undefined: uapi.HandleFlag
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/gpiod.go:629:42: undefined: uapi.EventFlag
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/gpiod.go:642:49: undefined: uapi.LineFlagV2
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/gpiod.go:679:55: undefined: uapi.LineAttribute
../../../.asdf/installs/golang/1.21.4/packages/pkg/mod/github.com/warthog618/gpiod@v0.8.2/options.go:93:50: too many errors

Digging into this led me to this issue which suggests the issue may be with the fact that I'm on a Mac, but the suggestions in that thread haven't gotten me to a successful build yet.

gen2thomas commented 11 months ago

Hi @tlindsay , this means you have already build it in this way and this is also not working?

GOOS=linux GOARCH=arm GOARM=6 go build main.go

In addition: this is not an ESP32 issue, it is related to Mac usage at this point.

I'm not sure, which part depends on gpiod, but most likely the "gpio.LedDriver". Can you start with this example to reduce dependencies: https://github.com/hybridgroup/gobot/blob/release/platforms/firmata/client/examples/blink.go