2017-03-13 23:01:39 +08:00
|
|
|
// +build example
|
|
|
|
//
|
|
|
|
// Do not build by default.
|
|
|
|
|
2016-05-14 08:30:46 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
2016-05-14 08:30:46 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
robot := gobot.NewRobot(
|
|
|
|
"hello",
|
|
|
|
func() {
|
2016-12-09 03:32:02 +08:00
|
|
|
done := gobot.Every(750*time.Millisecond, func() {
|
2016-05-14 08:30:46 +08:00
|
|
|
fmt.Println("Greetings human")
|
|
|
|
})
|
|
|
|
|
|
|
|
gobot.After(5*time.Second, func() {
|
2016-12-09 03:32:02 +08:00
|
|
|
done.Stop()
|
2016-05-14 08:30:46 +08:00
|
|
|
fmt.Println("We're done here")
|
|
|
|
})
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2016-10-19 03:08:25 +08:00
|
|
|
robot.Start()
|
2016-05-14 08:30:46 +08:00
|
|
|
}
|