2016-05-14 08:30:46 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-10-16 02:02:54 +08:00
|
|
|
gbot := gobot.NewMaster()
|
2016-05-14 08:30:46 +08:00
|
|
|
|
|
|
|
robot := gobot.NewRobot(
|
|
|
|
"hello",
|
|
|
|
func() {
|
|
|
|
done := gobot.Every(500*time.Millisecond, func() {
|
|
|
|
fmt.Println("Greetings human")
|
|
|
|
})
|
|
|
|
|
|
|
|
gobot.After(5*time.Second, func() {
|
|
|
|
done <- true
|
|
|
|
fmt.Println("We're done here")
|
|
|
|
})
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
gbot.AddRobot(robot)
|
|
|
|
|
|
|
|
gbot.Start()
|
|
|
|
}
|