The GoPiGo is a delightful and complete robot for the Raspberry Pi that turns your Pi into a fully operating robot. GoPiGo is a mobile robotic platform for the Raspberry Pi developed by Dexter Industries.
This repository contains Go library for interacting with the GoPiGo robot. This is a port of python library of GoPiGo in Go language.
Get the source with: go get -d -u github.com/droot/gopigo
package main
import (
"github.com/droot/gopigo"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/all"
)
func main() {
if err := embd.InitI2C(); err != nil {
panic(err)
}
defer embd.CloseI2C()
bus := embd.NewI2CBus(1)
// create GoPiGo instance.
gp := gopigo.New(bus)
// move GoPiGo forward by 40 cms
err := gp.fwd(40)
// move GoPiGo backward
err = gp.Bwd(0)
// make GoPiGo stop
err = gp.Stop()
// make GoPiGo take Left turn
err = gp.Left()
// make GoPiGo take right turn
err = gp.Right()
// Read Battery level of GoPiGo
volt, err := gp.BatteryVoltage()
.....
}
API documentation is available at https://godoc.org/github.com/droot/gopigo
Special Thanks to Dexter Industries for providing GoPiGo kit for the development.
- Issues: https://github.com/droot/gopigo/issues
- twitter: @droot