Esempio n. 1
0
func main() {
	gobot.Api(Master)

	spheros := map[string]string{
		"Sphero-BPO": "/dev/rfcomm0",
	}

	for name, port := range spheros {
		spheroAdaptor := new(gobotSphero.SpheroAdaptor)
		spheroAdaptor.Name = "sphero"
		spheroAdaptor.Port = port

		sphero := gobotSphero.NewSphero(spheroAdaptor)
		sphero.Name = "sphero"
		sphero.Interval = "0.5s"

		work := func() {
			sphero.SetRGB(uint8(255), uint8(0), uint8(0))
		}

		Master.Robots = append(Master.Robots, gobot.Robot{
			Name:        name,
			Connections: []gobot.Connection{spheroAdaptor},
			Devices:     []gobot.Device{sphero},
			Work:        work,
			Commands:    map[string]interface{}{"TurnBlue": TurnBlue},
		})
	}

	Master.Start()
}
Esempio n. 2
0
func main() {
	master := gobot.GobotMaster()
	gobot.Api(master)

	hello := new(gobot.Robot)
	hello.Name = "hello"
	hello.Commands = map[string]interface{}{"Hello": Hello}

	master.Robots = append(master.Robots, *hello)

	master.Start()
}
Esempio n. 3
0
func main() {
	master := gobot.GobotMaster()
	api := gobot.Api(master)
	api.Username = "******"
	api.Password = "******"

	hello := new(gobot.Robot)
	hello.Name = "hello"
	hello.Commands = map[string]interface{}{"Hello": Hello}

	master.Robots = append(master.Robots, hello)

	master.Start()
}