[![Gobot](https://raw.githubusercontent.com/hybridgroup/gobot-site/master/source/images/elements/gobot-logo-small.png)](http://gobot.io/)
[![GoDoc](https://godoc.org/gobot.io/x/gobot/v2?status.svg)](https://godoc.org/gobot.io/x/gobot/v2)
[![CircleCI Build status](https://circleci.com/gh/hybridgroup/gobot/tree/dev.svg?style=svg)](https://circleci.com/gh/hybridgroup/gobot/tree/dev)
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/ix29evnbdrhkr7ud/branch/dev?svg=true)](https://ci.appveyor.com/project/deadprogram/gobot/branch/dev)
[![codecov](https://codecov.io/gh/hybridgroup/gobot/branch/dev/graph/badge.svg)](https://codecov.io/gh/hybridgroup/gobot)
[![Go Report Card](https://goreportcard.com/badge/hybridgroup/gobot)](https://goreportcard.com/report/hybridgroup/gobot)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/hybridgroup/gobot/blob/master/LICENSE.txt)
Gobot (<https://gobot.io/>) is a framework using the Go programming language (<https://golang.org/>) 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 (<https://tinygo.org/>)
## 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](./examples). 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 /<path to gobot folder>/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(1*time.Second, func() {
led.Toggle()
})
}
robot := gobot.NewRobot("bot",
[]gobot.Connection{firmataAdaptor},
[]gobot.Device{led},
work,
)
robot.Start()
}
```
### Gobot with Sphero
```go
package main
import (
"fmt"
"time"
"gobot.io/x/gobot/v2"
"gobot.io/x/gobot/v2/platforms/sphero"
)
func main() {
adaptor := sphero.NewAdaptor("/dev/rfcomm0")
driver := sphero.NewSpheroDriver(adaptor)
work := func() {
gobot.Every(3*time.Second, func() {
driver.Roll(30, uint16(gobot.Rand(360)))
})
}
robot := gobot.NewRobot("sphero",
[]gobot.Connection{adaptor},
[]gobot.Device{driver},
work,
)
robot.Start()
}
```
### "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 pure idiomatic Golang code ("Metal" Gobot). For example:
```go
package main
import (
"gobot.io/x/gobot/v2/drivers/gpio"
"gobot.io/x/gobot/v2/platforms/intel-iot/edison"
"time"
)
func main() {
e := edison.NewAdaptor()
e.Connect()
led := gpio.NewLedDriver(e, "13")
led.Start()
for {
led.Toggle()
time.Sleep(1000 * time.Millisecond)
}
}
```
### "Master" Gobot
You can also use the full capabilities of the framework aka "Master Gobot" to control swarms of robots or other features
such as the built-in API server. For example:
```go
package main
import (
"fmt"
"time"
"gobot.io/x/gobot/v2"
"gobot.io/x/gobot/v2/api"
"gobot.io/x/gobot/v2/platforms/sphero"
)
func NewSwarmBot(port string) *gobot.Robot {
spheroAdaptor := sphero.NewAdaptor(port)
spheroDriver := sphero.NewSpheroDriver(spheroAdaptor)
spheroDriver.SetName("Sphero" + port)
work := func() {
spheroDriver.Stop()
spheroDriver.On(sphero.Collision, func(data interface{}) {
fmt.Println("Collision Detected!")
})
gobot.Every(1*time.Second, func() {
spheroDriver.Roll(100, uint16(gobot.Rand(360)))
})
gobot.Every(3*time.Second, func() {
spheroDriver.SetRGB(uint8(gobot.Rand(255)),
uint8(gobot.Rand(255)),
uint8(gobot.Rand(255)),
)
})
}
robot := gobot.NewRobot("sphero",
[]gobot.Connection{spheroAdaptor},
[]gobot.Device{spheroDriver},
work,
)
return robot
}
func main() {
master := gobot.NewMaster()
api.NewAPI(master).Start()
spheros := []string{
"/dev/rfcomm0",
"/dev/rfcomm1",
"/dev/rfcomm2",
"/dev/rfcomm3",
}
for _, port := range spheros {
master.AddRobot(NewSwarmBot(port))
}
master.Start()
}
```
## Hardware Support
Gobot has a extensible system for connecting to hardware devices. The following robotics and physical computing
platforms are currently supported:
- [Arduino](http://www.arduino.cc/) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/firmata)
- Audio <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/audio)
- [Beaglebone Black](http://beagleboard.org/boards) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/beaglebone)
- [Beaglebone PocketBeagle](http://beagleboard.org/pocket/) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/beaglebone)
- [Bluetooth LE](https://www.bluetooth.com/what-is-bluetooth-technology/bluetooth-technology-basics/low-energy) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/ble)
- [C.H.I.P](http://www.nextthing.co/pages/chip) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/chip)
- [C.H.I.P Pro](https://docs.getchip.com/chip_pro.html) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/chip)
- [Digispark](http://digistump.com/products/1) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/digispark)
- [DJI Tello](https://www.ryzerobotics.com/tello) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/dji/tello)
- [DragonBoard](https://developer.qualcomm.com/hardware/dragonboard-410c) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/dragonboard)
- [ESP8266](http://esp8266.net/) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/firmata)
- [GoPiGo 3](https://www.dexterindustries.com/gopigo3/) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/dexter/gopigo3)
- [Intel Curie](https://www.intel.com/content/www/us/en/products/boards-kits/curie.html) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/intel-iot/curie)
- [Intel Edison](http://www.intel.com/content/www/us/en/do-it-yourself/edison.html) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/intel-iot/edison)
- [Intel Joule](http://intel.com/joule/getstarted) <=> [Package](https://github.com/hybridgroup/gobot/tree/master/platforms/intel-iot/joule)
- [Jetson Nano](https://developer.nvidia.com/embedded/jetson-nano/) <=>
没有合适的资源?快使用搜索试试~ 我知道了~
GoBot用于机器人、无人机、物联网(IoT)Golang框架
共881个文件
go:756个
md:58个
license:33个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 32 浏览量
2024-04-08
22:28:16
上传
评论
收藏 2.06MB ZIP 举报
温馨提示
GoBot用于机器人、无人机、物联网(IoT)Golang框架,它提供了一种简单而强大的方法来创建解决方案,这些解决方案将多个不同的硬件设备合并在一起。 mkdir ~/my_gobot_example cd ~/my_gobot_example go mod init my.gobot.example.com 将示例文件复制到 go.mod 文件旁边,导入要求并构建。 cp /<path to gobot folder>/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
资源推荐
资源详情
资源评论
收起资源包目录
GoBot用于机器人、无人机、物联网(IoT)Golang框架 (881个子文件)
littleWire.c 17KB
opendevice.c 8KB
littleWire_servo.c 3KB
littleWire_util.c 174B
ff.conf 438B
robeaux.go 2.1MB
common.go 379KB
driver.go 28KB
mfrc522_pcd_register.go 23KB
easy_driver_test.go 19KB
mcp23017_driver_test.go 19KB
driver.go 19KB
edison_adaptor_test.go 19KB
client.go 19KB
pcf8583_driver_test.go 18KB
i2c_device_test.go 16KB
ads1x15_driver.go 15KB
pca953x_driver_test.go 15KB
api.go 14KB
api_test.go 14KB
raspi_adaptor_test.go 14KB
pwmpinsadaptor_test.go 14KB
mcp23017_driver.go 13KB
adaptor_test.go 13KB
stepper_driver.go 13KB
client.go 13KB
th02_driver_test.go 13KB
tsl2561_driver.go 13KB
ollie_driver.go 13KB
mfrc522_picc.go 13KB
minidrone_driver.go 13KB
sphero_driver.go 13KB
pwmpinsadaptor.go 12KB
beaglebone_adaptor_test.go 12KB
pcf8583_driver.go 12KB
hd44780_driver.go 12KB
ssd1306_driver.go 12KB
nanopi_adaptor_test.go 12KB
i2c_device.go 11KB
adafruit2348_driver.go 11KB
digitalpin_sysfs_test.go 11KB
pca9685_driver_test.go 11KB
pcf8591_driver.go 11KB
ssd1306_driver.go 11KB
client_test.go 11KB
ccs811_driver.go 11KB
stepper_driver_test.go 11KB
bmp280_driver.go 11KB
digispark_i2c_test.go 10KB
bmp388_driver.go 10KB
mfrc522_pcd.go 10KB
adaptor_test.go 10KB
adxl345_driver.go 10KB
mpu6050_driver.go 10KB
adaptor.go 10KB
edison_adaptor.go 10KB
hcsr04_driver_test.go 10KB
pca9501_driver_test.go 10KB
jhd1313m1_driver.go 10KB
digitalpin_gpiod.go 10KB
hmc5883l_driver.go 9KB
yl40_driver.go 9KB
digitalpin_config.go 9KB
digitalpin_config_test.go 9KB
adxl345_driver_test.go 9KB
constants.go 9KB
tsl2561_driver_test.go 9KB
adafruit1109_driver.go 9KB
bmp180_driver_test.go 8KB
wiichuck_driver_test.go 8KB
ssd1306_driver_test.go 8KB
digitalpinsadaptor.go 8KB
hcsr04_driver.go 8KB
pca953x_driver.go 8KB
tello_facetracker.go 8KB
yl40_driver_test.go 8KB
analog_sensor_driver_test.go 8KB
pca9685_driver.go 8KB
ads1x15_driver_1015_test.go 8KB
ads1x15_driver_1115_test.go 8KB
analog_sensor_driver.go 8KB
adaptor.go 8KB
temperature_sensor_driver_test.go 8KB
grovepi_driver.go 8KB
digitalpin_gpiod_test.go 8KB
grovepi_driver_test.go 8KB
adaptor_test.go 7KB
bme280_driver.go 7KB
adafruit1109_driver_test.go 7KB
motor_driver.go 7KB
ccs811_driver_test.go 7KB
chip_adaptor_test.go 7KB
hd44780_driver_test.go 7KB
l3gd20h_driver_test.go 7KB
imu_driver.go 7KB
bme280_driver_test.go 7KB
bmp280_driver_test.go 7KB
bmp180_driver.go 7KB
analogpinsadaptor_test.go 7KB
mqtt_adaptor.go 7KB
共 881 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
新华
- 粉丝: 1w+
- 资源: 628
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- CNKI-20241108164243230.es6
- Go-基于linux时间轮的高效低精度定时器+项目源码+文档说明
- 创维5S02机芯 15U50系列 20151207主程序软件 电视刷机 固件升级包
- 基于Linux+ARM-CotexA53+sqlite3的停车场计费系统设计与实现+项目源码+文档说明
- 2023年GPT-4v多模态技术进展与应用前景分析
- 编译原理课程设计,Python基于有穷自动机的类 C 语言词法分析器源代码+使用说明
- XC7Z010CLG-400 HDMI文字叠加实验完整工程
- 利用自定义注解与Hutool库对SpringBoot接口返回数据进行高效脱敏处理
- 传媒行业研究报告:聚焦AI辅助创作与AIGC能力的产品化进展 - 2023年上半年值得买(300785)公司业绩点评
- 本科毕业设计-基于WIFI网络的车间设备监测与控制系统+项目源码+文档说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功