hybridgroup /gobot
Golang framework for robotics, drones, and the Internet of Things (IoT)
★ 9,498⑂ 1,060👁 307⑃ 738● 458▤ 51
-1
Daily
9,498
stars
1,060
forks
307
watchers
738
prs
458
issues
51
releases
README
Gobot () is a framework using the Go programming language () for robotics, physical
computing, and the Internet of Things.
It provides a simple, yet powerful way to create solutions that incorporate multiple, different hardware devices at the
same time.
Want to run Go directly on microcontrollers? Check out our sister project TinyGo ()
Getting Started
Get in touch
Get the Gobot source code by running this commands:
sh
git clone https://github.com/hybridgroup/gobot.git
git checkout release
Afterwards have a look at the examples directory. You need to find an example matching your platform for your
first test (e.g. "raspi_blink.go"). Than build the binary (cross compile), transfer it to your target and run it.
env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink examples/raspi_blink.go
Building the code on your local machine with the example code above will create a binary for ARMv5. This is probably not
what you need for your specific target platform. Please read also the platform specific documentation in the platform
subfolders.
Create your first project
Create a new folder and a new Go module project.
sh
mkdir ~/my_gobot_example
cd ~/my_gobot_example
go mod init my.gobot.example.com
Copy your example file besides the go.mod file, import the requirements and build.
sh
cp //examples/raspi_blink.go ~/my_gobot_example/
go mod tidy
env GOOS=linux GOARCH=arm GOARM=5 go build -o ./output/my_raspi_bink raspi_blink.go
Now you are ready to modify the example and test your changes. Start by removing the build directives at the beginning
of the file.
Examples
Gobot with Arduino
go
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(1time.Second, func() {
if err := led.Toggle(); err != nil {
fmt.Println(err)
}
})
}
robot := gobot.NewRobot("bot",
[]gobot.Connection{firmataAdaptor},
[]gobot.Device{led},
work,
)
if err := robot.Start(); err != nil {
panic(err)
}
}
Gobot with Sphero
go
package main
import (
"fmt"
"time"
"gobot.io/x/gobot/v2"
"gobot.io/x/gobot/v2/drivers/serial"
"gobot.io/x/gobot/v2/platforms/serialport"
)
func main() {
adaptor := serialport.NewAdaptor("/dev/rfcomm0")
driver := sphero.NewSpheroDriver(adaptor)
work := func() {
gobot.Every(3time.Second, func() {
driver.Roll(30, uint16(gobot.Rand(360)))
})
}
robot := gobot.NewRobot("sphero",
[]gobot.Connection{adaptor},
[]gobot.Device{driver},
work,
)
if err := robot.Start(); err != nil {
panic(err)
}
}
"Metal" Gobot
You can use the entire Gobot framework as shown in the examples above ("Classic" Gobot), or you can pick and choose from
the various Gobot packages to control hardware with nothing but puTop issues
#521Mac OS: tello_opencv.go error writing to ffmpeg stdin21 comments · 2018-05-07#508Override the default log with logrus?17 comments · 2018-04-02#430Neopixel RGB LED strip support?16 comments · 2017-06-17#244Fill Out Bebop Events, GPS Support?14 comments · 2015-11-07#518Unable to start Tello video on ubuntu 16.0410 comments · 2018-05-03#404Microbit OSX signal:killed10 comments · 2017-04-07#558Recover support9 comments · 2018-05-30#868Joystick:does not run properly on windows8 comments · 2022-10-18
Latest release
v2.6.0 v2.6.0 2025-10-18The main objective of this release is to update the Go version to 1.24 together with the linter version 2.4.0. Important module updates are done. Unreleased v2.6.0 (2025-10-18) Adaptors all: add debug option (1181) Ble fix some issues in connect and disconnect (1161) Build deps: update modules (1186) go, deps: switch to Go 1.24 linter 2.4.0 and update modules (1162) Common improve robot level errors (1180) Doc core: prepare for release v2.6.0 Drivers fix nil connector check (1178) I2c adafruit1109: rework debug messages (1182)